From e41878e2badc3a92f471129ea2fdc219eee7c336 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 2 Mar 2021 04:23:28 +0000 Subject: [PATCH] CodeGen from PR 13221 in Azure/azure-rest-api-specs Merge b9875495d5ea93338feabc9e9a3e4e46a2e44159 into abe10d9e0ac49b15e1c6e9f879ab48deca98cf15 --- src/redisenterprise/HISTORY.rst | 8 + src/redisenterprise/README.md | 109 ++ .../azext_redisenterprise/__init__.py | 50 + .../azext_redisenterprise/action.py | 17 + .../azext_redisenterprise/azext_metadata.json | 3 + .../azext_redisenterprise/custom.py | 17 + .../generated/__init__.py | 12 + .../generated/_client_factory.py | 36 + .../azext_redisenterprise/generated/_help.py | 353 +++++ .../generated/_params.py | 210 +++ .../generated/_validators.py | 9 + .../azext_redisenterprise/generated/action.py | 128 ++ .../generated/commands.py | 78 ++ .../azext_redisenterprise/generated/custom.py | 268 ++++ .../azext_redisenterprise/manual/__init__.py | 12 + .../azext_redisenterprise/tests/__init__.py | 116 ++ .../tests/latest/__init__.py | 12 + .../tests/latest/example_steps.py | 280 ++++ .../latest/test_redisenterprise_scenario.py | 105 ++ .../vendored_sdks/__init__.py | 12 + .../vendored_sdks/redisenterprise/__init__.py | 16 + .../redisenterprise/_configuration.py | 70 + .../_redis_enterprise_management_client.py | 94 ++ .../redisenterprise/aio/__init__.py | 10 + .../redisenterprise/aio/_configuration.py | 66 + .../_redis_enterprise_management_client.py | 88 ++ .../aio/operations/__init__.py | 23 + .../aio/operations/_databases_operations.py | 1017 ++++++++++++++ .../aio/operations/_operations.py | 105 ++ .../_operations_status_operations.py | 100 ++ ...private_endpoint_connections_operations.py | 378 +++++ .../_private_link_resources_operations.py | 117 ++ .../_redis_enterprise_operations.py | 606 ++++++++ .../redisenterprise/models/__init__.py | 131 ++ .../redisenterprise/models/_models.py | 1137 +++++++++++++++ .../redisenterprise/models/_models_py3.py | 1213 +++++++++++++++++ ...edis_enterprise_management_client_enums.py | 158 +++ .../redisenterprise/operations/__init__.py | 23 + .../operations/_databases_operations.py | 1036 ++++++++++++++ .../redisenterprise/operations/_operations.py | 110 ++ .../_operations_status_operations.py | 105 ++ ...private_endpoint_connections_operations.py | 387 ++++++ .../_private_link_resources_operations.py | 122 ++ .../_redis_enterprise_operations.py | 619 +++++++++ .../vendored_sdks/redisenterprise/py.typed | 1 + src/redisenterprise/report.md | 360 +++++ src/redisenterprise/setup.cfg | 1 + src/redisenterprise/setup.py | 58 + 48 files changed, 9986 insertions(+) create mode 100644 src/redisenterprise/HISTORY.rst create mode 100644 src/redisenterprise/README.md create mode 100644 src/redisenterprise/azext_redisenterprise/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/action.py create mode 100644 src/redisenterprise/azext_redisenterprise/azext_metadata.json create mode 100644 src/redisenterprise/azext_redisenterprise/custom.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/_client_factory.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/_help.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/_params.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/_validators.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/action.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/commands.py create mode 100644 src/redisenterprise/azext_redisenterprise/generated/custom.py create mode 100644 src/redisenterprise/azext_redisenterprise/manual/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/tests/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/tests/latest/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/tests/latest/example_steps.py create mode 100644 src/redisenterprise/azext_redisenterprise/tests/latest/test_redisenterprise_scenario.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_configuration.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_redis_enterprise_management_client.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_configuration.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_redis_enterprise_management_client.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_databases_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations_status_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_endpoint_connections_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_link_resources_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_redis_enterprise_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models_py3.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_redis_enterprise_management_client_enums.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/__init__.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_databases_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations_status_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_endpoint_connections_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_link_resources_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_redis_enterprise_operations.py create mode 100644 src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/py.typed create mode 100644 src/redisenterprise/report.md create mode 100644 src/redisenterprise/setup.cfg create mode 100644 src/redisenterprise/setup.py diff --git a/src/redisenterprise/HISTORY.rst b/src/redisenterprise/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/redisenterprise/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/redisenterprise/README.md b/src/redisenterprise/README.md new file mode 100644 index 00000000000..470ee63be3c --- /dev/null +++ b/src/redisenterprise/README.md @@ -0,0 +1,109 @@ +# Azure CLI redisenterprise Extension # +This is the extension for redisenterprise + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name redisenterprise +``` + +### Included Features ### +#### redisenterprise operation-status #### +##### Show ##### +``` +az redisenterprise operation-status show --operation-id "testoperationid" --location "West US" +``` +#### redisenterprise #### +##### Create ##### +``` +az redisenterprise create --cluster-name "cache1" --location "West US" --minimum-tls-version "1.2" \ + --sku name="EnterpriseFlash_F300" capacity=3 --tags tag1="value1" --zones "1" "2" "3" --resource-group "rg1" +``` +##### Show ##### +``` +az redisenterprise show --cluster-name "cache1" --resource-group "rg1" +``` +##### List ##### +``` +az redisenterprise list --resource-group "rg1" +``` +##### Update ##### +``` +az redisenterprise update --cluster-name "cache1" --minimum-tls-version "1.2" \ + --sku name="EnterpriseFlash_F300" capacity=9 --tags tag1="value1" --resource-group "rg1" +``` +##### Delete ##### +``` +az redisenterprise delete --cluster-name "cache1" --resource-group "rg1" +``` +#### redisenterprise database #### +##### Create ##### +``` +az redisenterprise database create --cluster-name "cache1" --database-name "default" --client-protocol "Encrypted" \ + --clustering-policy "EnterpriseCluster" --eviction-policy "AllKeysLRU" \ + --modules name="RedisBloom" args="ERROR_RATE 0.00 INITIAL_SIZE 400" \ + --modules name="RedisTimeSeries" args="RETENTION_POLICY 20" --modules name="RediSearch" \ + --persistence aof-enabled=true aof-frequency="1s" --port 10000 --resource-group "rg1" +``` +##### Show ##### +``` +az redisenterprise database show --cluster-name "cache1" --database-name "default" --resource-group "rg1" +``` +##### List ##### +``` +az redisenterprise database list --cluster-name "cache1" --resource-group "rg1" +``` +##### Update ##### +``` +az redisenterprise database update --cluster-name "cache1" --database-name "default" --client-protocol "Encrypted" \ + --eviction-policy "AllKeysLRU" --persistence rdb-enabled=true rdb-frequency="12h" --resource-group "rg1" +``` +##### Export ##### +``` +az redisenterprise database export --cluster-name "cache1" --database-name "default" \ + --sas-uri "https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters" --resource-group "rg1" +``` +##### Import ##### +``` +az redisenterprise database import --cluster-name "cache1" --database-name "default" \ + --sas-uri "https://contosostorage.blob.core.window.net/urltoBlobFile?sasKeyParameters" --resource-group "rg1" +``` +##### List-key ##### +``` +az redisenterprise database list-key --cluster-name "cache1" --database-name "default" --resource-group "rg1" +``` +##### Regenerate-key ##### +``` +az redisenterprise database regenerate-key --cluster-name "cache1" --database-name "default" --key-type "Primary" \ + --resource-group "rg1" +``` +##### Delete ##### +``` +az redisenterprise database delete --cluster-name "cache1" --database-name "db1" --resource-group "rg1" +``` +#### redisenterprise private-endpoint-connection #### +##### Put ##### +``` +az redisenterprise private-endpoint-connection put --cluster-name "cache1" --name "pectest01" \ + --private-link-service-connection-state description="Auto-Approved" status="Approved" --resource-group "rg1" + +az redisenterprise private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" \ + --resource-group "{rg}" +``` +##### Show ##### +``` +az redisenterprise private-endpoint-connection show --cluster-name "cache1" --name "pectest01" --resource-group "rg1" +``` +##### List ##### +``` +az redisenterprise private-endpoint-connection list --cluster-name "cache1" --resource-group "rg1" +``` +##### Delete ##### +``` +az redisenterprise private-endpoint-connection delete --cluster-name "cache1" --name "pectest01" --resource-group "rg1" +``` +#### redisenterprise private-link-resource #### +##### List ##### +``` +az redisenterprise private-link-resource list --cluster-name "cache1" --resource-group "rg1" +``` \ No newline at end of file diff --git a/src/redisenterprise/azext_redisenterprise/__init__.py b/src/redisenterprise/azext_redisenterprise/__init__.py new file mode 100644 index 00000000000..9f14113fd28 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/__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_redisenterprise.generated._help import helps # pylint: disable=unused-import +try: + from azext_redisenterprise.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class RedisEnterpriseManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_redisenterprise.generated._client_factory import cf_redisenterprise_cl + redisenterprise_custom = CliCommandType( + operations_tmpl='azext_redisenterprise.custom#{}', + client_factory=cf_redisenterprise_cl) + parent = super(RedisEnterpriseManagementClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=redisenterprise_custom) + + def load_command_table(self, args): + from azext_redisenterprise.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_redisenterprise.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_redisenterprise.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_redisenterprise.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = RedisEnterpriseManagementClientCommandsLoader diff --git a/src/redisenterprise/azext_redisenterprise/action.py b/src/redisenterprise/azext_redisenterprise/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/azext_metadata.json b/src/redisenterprise/azext_redisenterprise/azext_metadata.json new file mode 100644 index 00000000000..3695b0d7077 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/azext_metadata.json @@ -0,0 +1,3 @@ +{ + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/redisenterprise/azext_redisenterprise/custom.py b/src/redisenterprise/azext_redisenterprise/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/generated/__init__.py b/src/redisenterprise/azext_redisenterprise/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/generated/_client_factory.py b/src/redisenterprise/azext_redisenterprise/generated/_client_factory.py new file mode 100644 index 00000000000..28cb64a3dc9 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/_client_factory.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------- +# 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_redisenterprise_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_redisenterprise.vendored_sdks.redisenterprise import RedisEnterpriseManagementClient + return get_mgmt_service_client(cli_ctx, + RedisEnterpriseManagementClient) + + +def cf_operation_status(cli_ctx, *_): + return cf_redisenterprise_cl(cli_ctx).operations_status + + +def cf_redis_enterprise(cli_ctx, *_): + return cf_redisenterprise_cl(cli_ctx).redis_enterprise + + +def cf_database(cli_ctx, *_): + return cf_redisenterprise_cl(cli_ctx).databases + + +def cf_private_endpoint_connection(cli_ctx, *_): + return cf_redisenterprise_cl(cli_ctx).private_endpoint_connections + + +def cf_private_link_resource(cli_ctx, *_): + return cf_redisenterprise_cl(cli_ctx).private_link_resources diff --git a/src/redisenterprise/azext_redisenterprise/generated/_help.py b/src/redisenterprise/azext_redisenterprise/generated/_help.py new file mode 100644 index 00000000000..a84d02d8589 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/_help.py @@ -0,0 +1,353 @@ +# -------------------------------------------------------------------------- +# 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['redisenterprise operation-status'] = """ + type: group + short-summary: Manage operation status with redisenterprise +""" + +helps['redisenterprise operation-status show'] = """ + type: command + short-summary: "Gets the status of operation." + examples: + - name: OperationsStatusGet + text: |- + az redisenterprise operation-status show --operation-id "testoperationid" --location "West US" +""" + +helps['redisenterprise'] = """ + type: group + short-summary: Manage redis enterprise with redisenterprise +""" + +helps['redisenterprise list'] = """ + type: command + short-summary: "Lists all RedisEnterprise clusters in a resource group. And Gets all RedisEnterprise clusters in \ +the specified subscription." + examples: + - name: RedisEnterpriseListByResourceGroup + text: |- + az redisenterprise list --resource-group "rg1" + - name: RedisEnterpriseList + text: |- + az redisenterprise list +""" + +helps['redisenterprise show'] = """ + type: command + short-summary: "Gets information about a RedisEnterprise cluster." + examples: + - name: RedisEnterpriseGet + text: |- + az redisenterprise show --cluster-name "cache1" --resource-group "rg1" +""" + +helps['redisenterprise create'] = """ + type: command + short-summary: "Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster." + parameters: + - name: --sku + short-summary: "The SKU to create, which affects price, performance, and features." + long-summary: | + Usage: --sku name=XX capacity=XX + + name: Required. The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, \ +EnterpriseFlash_F300 etc.) + capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are \ +(2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. + examples: + - name: RedisEnterpriseCreate + text: |- + az redisenterprise create --cluster-name "cache1" --location "West US" --minimum-tls-version "1.2" \ +--sku name="EnterpriseFlash_F300" capacity=3 --tags tag1="value1" --zones "1" "2" "3" --resource-group "rg1" +""" + +helps['redisenterprise update'] = """ + type: command + short-summary: "Updates an existing RedisEnterprise cluster." + parameters: + - name: --sku + short-summary: "The SKU to create, which affects price, performance, and features." + long-summary: | + Usage: --sku name=XX capacity=XX + + name: Required. The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, \ +EnterpriseFlash_F300 etc.) + capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. Valid values are \ +(2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. + examples: + - name: RedisEnterpriseUpdate + text: |- + az redisenterprise update --cluster-name "cache1" --minimum-tls-version "1.2" --sku \ +name="EnterpriseFlash_F300" capacity=9 --tags tag1="value1" --resource-group "rg1" +""" + +helps['redisenterprise delete'] = """ + type: command + short-summary: "Deletes a RedisEnterprise cache cluster." + examples: + - name: RedisEnterpriseDelete + text: |- + az redisenterprise delete --cluster-name "cache1" --resource-group "rg1" +""" + +helps['redisenterprise wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the redisenterprise is met. + examples: + - name: Pause executing next line of CLI script until the redisenterprise is successfully created. + text: |- + az redisenterprise wait --cluster-name "cache1" --resource-group "rg1" --created + - name: Pause executing next line of CLI script until the redisenterprise is successfully updated. + text: |- + az redisenterprise wait --cluster-name "cache1" --resource-group "rg1" --updated + - name: Pause executing next line of CLI script until the redisenterprise is successfully deleted. + text: |- + az redisenterprise wait --cluster-name "cache1" --resource-group "rg1" --deleted +""" + +helps['redisenterprise database'] = """ + type: group + short-summary: Manage database with redisenterprise +""" + +helps['redisenterprise database list'] = """ + type: command + short-summary: "Gets all databases in the specified RedisEnterprise cluster." + examples: + - name: RedisEnterpriseDatabasesListByCluster + text: |- + az redisenterprise database list --cluster-name "cache1" --resource-group "rg1" +""" + +helps['redisenterprise database show'] = """ + type: command + short-summary: "Gets information about a database in a RedisEnterprise cluster." + examples: + - name: RedisEnterpriseDatabasesGet + text: |- + az redisenterprise database show --cluster-name "cache1" --database-name "default" --resource-group \ +"rg1" +""" + +helps['redisenterprise database create'] = """ + type: command + short-summary: "Creates a database." + parameters: + - name: --persistence + short-summary: "Persistence settings" + long-summary: | + Usage: --persistence aof-enabled=XX rdb-enabled=XX aof-frequency=XX rdb-frequency=XX + + aof-enabled: Sets whether AOF is enabled. + rdb-enabled: Sets whether RDB is enabled. + aof-frequency: Sets the frequency at which data is written to disk. + rdb-frequency: Sets the frequency at which a snapshot of the database is created. + - name: --modules + short-summary: "Optional set of redis modules to enable in this database - modules can only be added at \ +creation time." + long-summary: | + Usage: --modules name=XX args=XX + + name: Required. The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries' + args: Configuration options for the module, e.g. 'ERROR_RATE 0.00 INITIAL_SIZE 400'. + + Multiple actions can be specified by using more than one --modules argument. + examples: + - name: RedisEnterpriseDatabasesCreate + text: |- + az redisenterprise database create --cluster-name "cache1" --database-name "default" --client-protocol \ +"Encrypted" --clustering-policy "EnterpriseCluster" --eviction-policy "AllKeysLRU" --modules name="RedisBloom" \ +args="ERROR_RATE 0.00 INITIAL_SIZE 400" --modules name="RedisTimeSeries" args="RETENTION_POLICY 20" --modules \ +name="RediSearch" --persistence aof-enabled=true aof-frequency="1s" --port 10000 --resource-group "rg1" +""" + +helps['redisenterprise database update'] = """ + type: command + short-summary: "Updates a database." + parameters: + - name: --persistence + short-summary: "Persistence settings" + long-summary: | + Usage: --persistence aof-enabled=XX rdb-enabled=XX aof-frequency=XX rdb-frequency=XX + + aof-enabled: Sets whether AOF is enabled. + rdb-enabled: Sets whether RDB is enabled. + aof-frequency: Sets the frequency at which data is written to disk. + rdb-frequency: Sets the frequency at which a snapshot of the database is created. + - name: --modules + short-summary: "Optional set of redis modules to enable in this database - modules can only be added at \ +creation time." + long-summary: | + Usage: --modules name=XX args=XX + + name: Required. The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries' + args: Configuration options for the module, e.g. 'ERROR_RATE 0.00 INITIAL_SIZE 400'. + + Multiple actions can be specified by using more than one --modules argument. + examples: + - name: RedisEnterpriseDatabasesUpdate + text: |- + az redisenterprise database update --cluster-name "cache1" --database-name "default" --client-protocol \ +"Encrypted" --eviction-policy "AllKeysLRU" --persistence rdb-enabled=true rdb-frequency="12h" --resource-group "rg1" +""" + +helps['redisenterprise database delete'] = """ + type: command + short-summary: "Deletes a single database." + examples: + - name: RedisEnterpriseDatabasesDelete + text: |- + az redisenterprise database delete --cluster-name "cache1" --database-name "db1" --resource-group "rg1" +""" + +helps['redisenterprise database export'] = """ + type: command + short-summary: "Exports a database file from target database." + examples: + - name: RedisEnterpriseDatabasesExport + text: |- + az redisenterprise database export --cluster-name "cache1" --database-name "default" --sas-uri \ +"https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters" --resource-group "rg1" +""" + +helps['redisenterprise database import'] = """ + type: command + short-summary: "Imports a database file to target database." + examples: + - name: RedisEnterpriseDatabasesImport + text: |- + az redisenterprise database import --cluster-name "cache1" --database-name "default" --sas-uri \ +"https://contosostorage.blob.core.window.net/urltoBlobFile?sasKeyParameters" --resource-group "rg1" +""" + +helps['redisenterprise database list-key'] = """ + type: command + short-summary: "Retrieves the access keys for the RedisEnterprise database." + examples: + - name: RedisEnterpriseDatabasesListKeys + text: |- + az redisenterprise database list-key --cluster-name "cache1" --database-name "default" --resource-group \ +"rg1" +""" + +helps['redisenterprise database regenerate-key'] = """ + type: command + short-summary: "Regenerates the RedisEnterprise database's access keys." + examples: + - name: RedisEnterpriseDatabasesRegenerateKey + text: |- + az redisenterprise database regenerate-key --cluster-name "cache1" --database-name "default" --key-type \ +"Primary" --resource-group "rg1" +""" + +helps['redisenterprise database wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the redisenterprise database is met. + examples: + - name: Pause executing next line of CLI script until the redisenterprise database is successfully created. + text: |- + az redisenterprise database wait --cluster-name "cache1" --database-name "default" --resource-group \ +"rg1" --created + - name: Pause executing next line of CLI script until the redisenterprise database is successfully updated. + text: |- + az redisenterprise database wait --cluster-name "cache1" --database-name "default" --resource-group \ +"rg1" --updated + - name: Pause executing next line of CLI script until the redisenterprise database is successfully deleted. + text: |- + az redisenterprise database wait --cluster-name "cache1" --database-name "default" --resource-group \ +"rg1" --deleted +""" + +helps['redisenterprise private-endpoint-connection'] = """ + type: group + short-summary: Manage private endpoint connection with redisenterprise +""" + +helps['redisenterprise private-endpoint-connection list'] = """ + type: command + short-summary: "Lists all the private endpoint connections associated with the RedisEnterprise cluster." + examples: + - name: RedisEnterpriseListPrivateEndpointConnections + text: |- + az redisenterprise private-endpoint-connection list --cluster-name "cache1" --resource-group "rg1" +""" + +helps['redisenterprise private-endpoint-connection show'] = """ + type: command + short-summary: "Gets the specified private endpoint connection associated with the RedisEnterprise cluster." + examples: + - name: RedisEnterpriseGetPrivateEndpointConnection + text: |- + az redisenterprise private-endpoint-connection show --cluster-name "cache1" --name "pectest01" \ +--resource-group "rg1" +""" + +helps['redisenterprise private-endpoint-connection delete'] = """ + type: command + short-summary: "Deletes the specified private endpoint connection associated with the RedisEnterprise cluster." + examples: + - name: RedisEnterpriseDeletePrivateEndpointConnection + text: |- + az redisenterprise private-endpoint-connection delete --cluster-name "cache1" --name "pectest01" \ +--resource-group "rg1" +""" + +helps['redisenterprise private-endpoint-connection put'] = """ + type: command + short-summary: "Updates the state of the specified private endpoint connection associated with the RedisEnterprise \ +cluster." + parameters: + - name: --private-link-service-connection-state + short-summary: "A collection of information about the state of the connection between service consumer and \ +provider." + long-summary: | + Usage: --private-link-service-connection-state status=XX description=XX actions-required=XX + + status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + description: The reason for approval/rejection of the connection. + actions-required: A message indicating if changes on the service provider require any updates on the \ +consumer. + examples: + - name: RedisEnterprisePutPrivateEndpointConnection + text: |- + az redisenterprise private-endpoint-connection put --cluster-name "cache1" --name "pectest01" \ +--private-link-service-connection-state description="Auto-Approved" status="Approved" --resource-group "rg1" +""" + +helps['redisenterprise private-endpoint-connection wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the redisenterprise \ +private-endpoint-connection is met. + examples: + - name: Pause executing next line of CLI script until the redisenterprise private-endpoint-connection is \ +successfully created. + text: |- + az redisenterprise private-endpoint-connection wait --cluster-name "cache1" --name "pectest01" \ +--resource-group "rg1" --created +""" + +helps['redisenterprise private-link-resource'] = """ + type: group + short-summary: Manage private link resource with redisenterprise +""" + +helps['redisenterprise private-link-resource list'] = """ + type: command + short-summary: "Gets the private link resources that need to be created for a RedisEnterprise cluster." + examples: + - name: RedisEnterpriseListPrivateLinkResources + text: |- + az redisenterprise private-link-resource list --cluster-name "cache1" --resource-group "rg1" +""" diff --git a/src/redisenterprise/azext_redisenterprise/generated/_params.py b/src/redisenterprise/azext_redisenterprise/generated/_params.py new file mode 100644 index 00000000000..212aee9b764 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/_params.py @@ -0,0 +1,210 @@ +# -------------------------------------------------------------------------- +# 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 ( + tags_type, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_redisenterprise.action import ( + AddSku, + AddPersistence, + AddModules, + AddPrivateLinkServiceConnectionState +) + + +def load_arguments(self, _): + + with self.argument_context('redisenterprise operation-status show') as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') + c.argument('operation_id', type=str, help='The operation\'s unique identifier.', id_part='child_name_1') + + with self.argument_context('redisenterprise list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('redisenterprise show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + + with self.argument_context('redisenterprise create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + c.argument('sku', action=AddSku, nargs='+', help='The SKU to create, which affects price, performance, and ' + 'features.') + c.argument('zones', options_list=['--zones', '-z'], nargs='+', help='The Availability Zones where this cluster ' + 'will be deployed.') + c.argument('minimum_tls_version', arg_type=get_enum_type(['1.0', '1.1', '1.2']), help='The minimum TLS version ' + 'for the cluster to support, e.g. \'1.2\'') + + with self.argument_context('redisenterprise update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('sku', action=AddSku, nargs='+', help='The SKU to create, which affects price, performance, and ' + 'features.') + c.argument('tags', tags_type) + c.argument('minimum_tls_version', arg_type=get_enum_type(['1.0', '1.1', '1.2']), help='The minimum TLS version ' + 'for the cluster to support, e.g. \'1.2\'') + + with self.argument_context('redisenterprise delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + + with self.argument_context('redisenterprise wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + + with self.argument_context('redisenterprise database list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') + + with self.argument_context('redisenterprise database show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + + with self.argument_context('redisenterprise database create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') + c.argument('database_name', type=str, help='The name of the database.') + c.argument('client_protocol', arg_type=get_enum_type(['Encrypted', 'Plaintext']), help='Specifies whether ' + 'redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is ' + 'TLS-encrypted.') + c.argument('port', type=int, help='TCP port of the database endpoint. Specified at create time. Defaults to an ' + 'available port.') + c.argument('clustering_policy', arg_type=get_enum_type(['EnterpriseCluster', 'OSSCluster']), help='Clustering ' + 'policy - default is OSSCluster. Specified at create time.') + c.argument('eviction_policy', arg_type=get_enum_type(['AllKeysLFU', 'AllKeysLRU', 'AllKeysRandom', + 'VolatileLRU', 'VolatileLFU', 'VolatileTTL', + 'VolatileRandom', 'NoEviction']), help='Redis eviction ' + 'policy - default is VolatileLRU') + c.argument('persistence', action=AddPersistence, nargs='+', help='Persistence settings') + c.argument('modules', action=AddModules, nargs='+', help='Optional set of redis modules to enable in this ' + 'database - modules can only be added at creation time.') + + with self.argument_context('redisenterprise database update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + c.argument('client_protocol', arg_type=get_enum_type(['Encrypted', 'Plaintext']), help='Specifies whether ' + 'redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is ' + 'TLS-encrypted.') + c.argument('port', type=int, help='TCP port of the database endpoint. Specified at create time. Defaults to an ' + 'available port.') + c.argument('clustering_policy', arg_type=get_enum_type(['EnterpriseCluster', 'OSSCluster']), help='Clustering ' + 'policy - default is OSSCluster. Specified at create time.') + c.argument('eviction_policy', arg_type=get_enum_type(['AllKeysLFU', 'AllKeysLRU', 'AllKeysRandom', + 'VolatileLRU', 'VolatileLFU', 'VolatileTTL', + 'VolatileRandom', 'NoEviction']), help='Redis eviction ' + 'policy - default is VolatileLRU') + c.argument('persistence', action=AddPersistence, nargs='+', help='Persistence settings') + c.argument('modules', action=AddModules, nargs='+', help='Optional set of redis modules to enable in this ' + 'database - modules can only be added at creation time.') + + with self.argument_context('redisenterprise database delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + + with self.argument_context('redisenterprise database export') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + c.argument('sas_uri', type=str, help='SAS URI for the target directory to export to') + + with self.argument_context('redisenterprise database import') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + c.argument('sas_uri', type=str, help='SAS URI for the target blob to import from') + + with self.argument_context('redisenterprise database list-key') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') + c.argument('database_name', type=str, help='The name of the database.') + + with self.argument_context('redisenterprise database regenerate-key') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + c.argument('key_type', arg_type=get_enum_type(['Primary', 'Secondary']), + help='Which access key to regenerate.') + + with self.argument_context('redisenterprise database wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('database_name', type=str, help='The name of the database.', id_part='child_name_1') + + with self.argument_context('redisenterprise private-endpoint-connection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') + + with self.argument_context('redisenterprise private-endpoint-connection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + with self.argument_context('redisenterprise private-endpoint-connection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + with self.argument_context('redisenterprise private-endpoint-connection put') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + c.argument('private_link_service_connection_state', action=AddPrivateLinkServiceConnectionState, nargs='+', + help='A collection of information about the state of the connection between service consumer and ' + 'provider.') + + with self.argument_context('redisenterprise private-endpoint-connection wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.', id_part='name') + c.argument('private_endpoint_connection_name', options_list=['--name', '-n', '--private-endpoint-connection-nam' + 'e'], type=str, help='The name of the private ' + 'endpoint connection associated with the Azure resource', id_part='child_name_1') + + with self.argument_context('redisenterprise private-link-resource list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', options_list=['--cluster-name', '--name', '-n'], type=str, help='The name of the ' + 'RedisEnterprise cluster.') diff --git a/src/redisenterprise/azext_redisenterprise/generated/_validators.py b/src/redisenterprise/azext_redisenterprise/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/generated/action.py b/src/redisenterprise/azext_redisenterprise/generated/action.py new file mode 100644 index 00000000000..5325d026e11 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/action.py @@ -0,0 +1,128 @@ +# -------------------------------------------------------------------------- +# 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 + +import argparse +from collections import defaultdict +from knack.util import CLIError + + +class AddSku(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.sku = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'capacity': + d['capacity'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, ' + 'capacity'.format(k)) + return d + + +class AddPersistence(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.persistence = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'aof-enabled': + d['aof_enabled'] = v[0] + elif kl == 'rdb-enabled': + d['rdb_enabled'] = v[0] + elif kl == 'aof-frequency': + d['aof_frequency'] = v[0] + elif kl == 'rdb-frequency': + d['rdb_frequency'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter persistence. All possible keys are: ' + 'aof-enabled, rdb-enabled, aof-frequency, rdb-frequency'.format(k)) + return d + + +class AddModules(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddModules, self).__call__(parser, namespace, action, option_string) + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'args': + d['args'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter modules. All possible keys are: name, ' + 'args'.format(k)) + return d + + +class AddPrivateLinkServiceConnectionState(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.private_link_service_connection_state = action + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'status': + d['status'] = v[0] + elif kl == 'description': + d['description'] = v[0] + elif kl == 'actions-required': + d['actions_required'] = v[0] + else: + raise CLIError('Unsupported Key {} is provided for parameter private_link_service_connection_state. ' + 'All possible keys are: status, description, actions-required'.format(k)) + return d diff --git a/src/redisenterprise/azext_redisenterprise/generated/commands.py b/src/redisenterprise/azext_redisenterprise/generated/commands.py new file mode 100644 index 00000000000..cc4e25a7cba --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/commands.py @@ -0,0 +1,78 @@ +# -------------------------------------------------------------------------- +# 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_redisenterprise.generated._client_factory import cf_operation_status + redisenterprise_operation_status = CliCommandType( + operations_tmpl='azext_redisenterprise.vendored_sdks.redisenterprise.operations._operations_status_operations#O' + 'perationsStatusOperations.{}', + client_factory=cf_operation_status) + with self.command_group('redisenterprise operation-status', redisenterprise_operation_status, + client_factory=cf_operation_status) as g: + g.custom_show_command('show', 'redisenterprise_operation_status_show') + + from azext_redisenterprise.generated._client_factory import cf_redis_enterprise + redisenterprise_redis_enterprise = CliCommandType( + operations_tmpl='azext_redisenterprise.vendored_sdks.redisenterprise.operations._redis_enterprise_operations#Re' + 'disEnterpriseOperations.{}', + client_factory=cf_redis_enterprise) + with self.command_group('redisenterprise', redisenterprise_redis_enterprise, + client_factory=cf_redis_enterprise) as g: + g.custom_command('list', 'redisenterprise_list') + g.custom_show_command('show', 'redisenterprise_show') + g.custom_command('create', 'redisenterprise_create', supports_no_wait=True) + g.custom_command('update', 'redisenterprise_update', supports_no_wait=True) + g.custom_command('delete', 'redisenterprise_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'redisenterprise_show') + + from azext_redisenterprise.generated._client_factory import cf_database + redisenterprise_database = CliCommandType( + operations_tmpl='azext_redisenterprise.vendored_sdks.redisenterprise.operations._databases_operations#Databases' + 'Operations.{}', + client_factory=cf_database) + with self.command_group('redisenterprise database', redisenterprise_database, client_factory=cf_database) as g: + g.custom_command('list', 'redisenterprise_database_list') + g.custom_show_command('show', 'redisenterprise_database_show') + g.custom_command('create', 'redisenterprise_database_create', supports_no_wait=True) + g.custom_command('update', 'redisenterprise_database_update', supports_no_wait=True) + g.custom_command('delete', 'redisenterprise_database_delete', supports_no_wait=True, confirmation=True) + g.custom_command('export', 'redisenterprise_database_export', supports_no_wait=True) + g.custom_command('import', 'redisenterprise_database_import', supports_no_wait=True) + g.custom_command('list-key', 'redisenterprise_database_list_key') + g.custom_command('regenerate-key', 'redisenterprise_database_regenerate_key', supports_no_wait=True) + g.custom_wait_command('wait', 'redisenterprise_database_show') + + from azext_redisenterprise.generated._client_factory import cf_private_endpoint_connection + redisenterprise_private_endpoint_connection = CliCommandType( + operations_tmpl='azext_redisenterprise.vendored_sdks.redisenterprise.operations._private_endpoint_connections_o' + 'perations#PrivateEndpointConnectionsOperations.{}', + client_factory=cf_private_endpoint_connection) + with self.command_group('redisenterprise private-endpoint-connection', redisenterprise_private_endpoint_connection, + client_factory=cf_private_endpoint_connection) as g: + g.custom_command('list', 'redisenterprise_private_endpoint_connection_list') + g.custom_show_command('show', 'redisenterprise_private_endpoint_connection_show') + g.custom_command('delete', 'redisenterprise_private_endpoint_connection_delete', confirmation=True) + g.custom_command('put', 'redisenterprise_private_endpoint_connection_put', supports_no_wait=True) + g.custom_wait_command('wait', 'redisenterprise_private_endpoint_connection_show') + + from azext_redisenterprise.generated._client_factory import cf_private_link_resource + redisenterprise_private_link_resource = CliCommandType( + operations_tmpl='azext_redisenterprise.vendored_sdks.redisenterprise.operations._private_link_resources_operati' + 'ons#PrivateLinkResourcesOperations.{}', + client_factory=cf_private_link_resource) + with self.command_group('redisenterprise private-link-resource', redisenterprise_private_link_resource, + client_factory=cf_private_link_resource) as g: + g.custom_command('list', 'redisenterprise_private_link_resource_list') diff --git a/src/redisenterprise/azext_redisenterprise/generated/custom.py b/src/redisenterprise/azext_redisenterprise/generated/custom.py new file mode 100644 index 00000000000..85d5e80aef8 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/generated/custom.py @@ -0,0 +1,268 @@ +# -------------------------------------------------------------------------- +# 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 redisenterprise_operation_status_show(client, + location, + operation_id): + return client.get(location=location, + operation_id=operation_id) + + +def redisenterprise_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list() + + +def redisenterprise_show(client, + resource_group_name, + cluster_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def redisenterprise_create(client, + resource_group_name, + cluster_name, + location, + sku, + tags=None, + zones=None, + minimum_tls_version=None, + no_wait=False): + parameters = {} + parameters['tags'] = tags + parameters['location'] = location + parameters['sku'] = sku + parameters['zones'] = zones + parameters['minimum_tls_version'] = minimum_tls_version + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters) + + +def redisenterprise_update(client, + resource_group_name, + cluster_name, + sku=None, + tags=None, + minimum_tls_version=None, + no_wait=False): + parameters = {} + parameters['sku'] = sku + parameters['tags'] = tags + parameters['minimum_tls_version'] = minimum_tls_version + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters) + + +def redisenterprise_delete(client, + resource_group_name, + cluster_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def redisenterprise_database_list(client, + resource_group_name, + cluster_name): + return client.list_by_cluster(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def redisenterprise_database_show(client, + resource_group_name, + cluster_name, + database_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def redisenterprise_database_create(client, + resource_group_name, + cluster_name, + database_name, + client_protocol=None, + port=None, + clustering_policy=None, + eviction_policy=None, + persistence=None, + modules=None, + no_wait=False): + parameters = {} + parameters['client_protocol'] = client_protocol + parameters['port'] = port + parameters['clustering_policy'] = clustering_policy + parameters['eviction_policy'] = eviction_policy + parameters['persistence'] = persistence + parameters['modules'] = modules + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def redisenterprise_database_update(client, + resource_group_name, + cluster_name, + database_name, + client_protocol=None, + port=None, + clustering_policy=None, + eviction_policy=None, + persistence=None, + modules=None, + no_wait=False): + parameters = {} + parameters['client_protocol'] = client_protocol + parameters['port'] = port + parameters['clustering_policy'] = clustering_policy + parameters['eviction_policy'] = eviction_policy + parameters['persistence'] = persistence + parameters['modules'] = modules + return sdk_no_wait(no_wait, + client.begin_update, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def redisenterprise_database_delete(client, + resource_group_name, + cluster_name, + database_name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def redisenterprise_database_export(client, + resource_group_name, + cluster_name, + database_name, + sas_uri, + no_wait=False): + parameters = {} + parameters['sas_uri'] = sas_uri + return sdk_no_wait(no_wait, + client.begin_export, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def redisenterprise_database_import(client, + resource_group_name, + cluster_name, + database_name, + sas_uri, + no_wait=False): + parameters = {} + parameters['sas_uri'] = sas_uri + return sdk_no_wait(no_wait, + client.begin_import_method, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def redisenterprise_database_list_key(client, + resource_group_name, + cluster_name, + database_name): + return client.list_keys(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def redisenterprise_database_regenerate_key(client, + resource_group_name, + cluster_name, + database_name, + key_type, + no_wait=False): + parameters = {} + parameters['key_type'] = key_type + return sdk_no_wait(no_wait, + client.begin_regenerate_key, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def redisenterprise_private_endpoint_connection_list(client, + resource_group_name, + cluster_name): + return client.list(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def redisenterprise_private_endpoint_connection_show(client, + resource_group_name, + cluster_name, + private_endpoint_connection_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name) + + +def redisenterprise_private_endpoint_connection_delete(client, + resource_group_name, + cluster_name, + private_endpoint_connection_name): + return client.delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name) + + +def redisenterprise_private_endpoint_connection_put(client, + resource_group_name, + cluster_name, + private_endpoint_connection_name, + private_link_service_connection_state=None, + no_wait=False): + properties = {} + properties['private_link_service_connection_state'] = private_link_service_connection_state + return sdk_no_wait(no_wait, + client.begin_put, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties) + + +def redisenterprise_private_link_resource_list(client, + resource_group_name, + cluster_name): + return client.list_by_cluster(resource_group_name=resource_group_name, + cluster_name=cluster_name) diff --git a/src/redisenterprise/azext_redisenterprise/manual/__init__.py b/src/redisenterprise/azext_redisenterprise/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/tests/__init__.py b/src/redisenterprise/azext_redisenterprise/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/tests/latest/__init__.py b/src/redisenterprise/azext_redisenterprise/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/tests/latest/example_steps.py b/src/redisenterprise/azext_redisenterprise/tests/latest/example_steps.py new file mode 100644 index 00000000000..7e06f4d28c8 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/tests/latest/example_steps.py @@ -0,0 +1,280 @@ +# -------------------------------------------------------------------------- +# 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: /Databases/put/RedisEnterpriseDatabasesCreate +@try_manual +def step_database_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database create ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--client-protocol "Encrypted" ' + '--clustering-policy "EnterpriseCluster" ' + '--eviction-policy "AllKeysLRU" ' + '--modules name="RedisBloom" args="ERROR_RATE 0.00 INITIAL_SIZE 400" ' + '--modules name="RedisTimeSeries" args="RETENTION_POLICY 20" ' + '--modules name="RediSearch" ' + '--persistence aof-enabled=true aof-frequency="1s" ' + '--port 10000 ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/get/RedisEnterpriseDatabasesGet +@try_manual +def step_database_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database show ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/get/RedisEnterpriseDatabasesListByCluster +@try_manual +def step_database_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database list ' + '--cluster-name "cache1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/patch/RedisEnterpriseDatabasesUpdate +@try_manual +def step_database_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database update ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--client-protocol "Encrypted" ' + '--eviction-policy "AllKeysLRU" ' + '--persistence rdb-enabled=true rdb-frequency="12h" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesExport +@try_manual +def step_database_export(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database export ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--sas-uri "https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesImport +@try_manual +def step_database_import(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database import ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--sas-uri "https://contosostorage.blob.core.window.net/urltoBlobFile?sasKeyParameters" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesListKeys +@try_manual +def step_database_list_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database list-key ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesRegenerateKey +@try_manual +def step_database_regenerate_key(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database regenerate-key ' + '--cluster-name "cache1" ' + '--database-name "default" ' + '--key-type "Primary" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /Databases/delete/RedisEnterpriseDatabasesDelete +@try_manual +def step_database_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise database delete -y ' + '--cluster-name "cache1" ' + '--database-name "db1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /OperationsStatus/get/OperationsStatusGet +@try_manual +def step_operation_status_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise operation-status show ' + '--operation-id "testoperationid" ' + '--location "West US"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/put/RedisEnterprisePutPrivateEndpointConnection +@try_manual +def step_private_endpoint_connection_put(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise private-endpoint-connection put ' + '--cluster-name "cache1" ' + '--name "{myPrivateEndpointConnection}" ' + '--private-link-service-connection-state description="Auto-Approved" status="Approved" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az redisenterprise private-endpoint-connection wait --created ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/get/RedisEnterpriseGetPrivateEndpointConnection +@try_manual +def step_private_endpoint_connection_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise private-endpoint-connection show ' + '--cluster-name "cache1" ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/get/RedisEnterpriseListPrivateEndpointConnections +@try_manual +def step_private_endpoint_connection_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise private-endpoint-connection list ' + '--cluster-name "cache1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /PrivateEndpointConnections/delete/RedisEnterpriseDeletePrivateEndpointConnection +@try_manual +def step_private_endpoint_connection_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise private-endpoint-connection delete -y ' + '--cluster-name "cache1" ' + '--name "{myPrivateEndpointConnection}" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /PrivateLinkResources/get/RedisEnterpriseListPrivateLinkResources +@try_manual +def step_private_link_resource_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise private-link-resource list ' + '--cluster-name "cache1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/put/RedisEnterpriseCreate +@try_manual +def step_create(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise create ' + '--cluster-name "cache1" ' + '--location "West US" ' + '--minimum-tls-version "1.2" ' + '--sku name="EnterpriseFlash_F300" capacity=3 ' + '--tags tag1="value1" ' + '--zones "1" "2" "3" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/get/RedisEnterpriseGet +@try_manual +def step_show(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise show ' + '--cluster-name "cache1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/get/RedisEnterpriseList +@try_manual +def step_list(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/get/RedisEnterpriseListByResourceGroup +@try_manual +def step_list2(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/patch/RedisEnterpriseUpdate +@try_manual +def step_update(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise update ' + '--cluster-name "cache1" ' + '--minimum-tls-version "1.2" ' + '--sku name="EnterpriseFlash_F300" capacity=9 ' + '--tags tag1="value1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /RedisEnterprise/delete/RedisEnterpriseDelete +@try_manual +def step_delete(test, rg, checks=None): + if checks is None: + checks = [] + test.cmd('az redisenterprise delete -y ' + '--cluster-name "cache1" ' + '--resource-group "{rg}"', + checks=checks) + diff --git a/src/redisenterprise/azext_redisenterprise/tests/latest/test_redisenterprise_scenario.py b/src/redisenterprise/azext_redisenterprise/tests/latest/test_redisenterprise_scenario.py new file mode 100644 index 00000000000..0e364ece082 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/tests/latest/test_redisenterprise_scenario.py @@ -0,0 +1,105 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_database_create +from .example_steps import step_database_show +from .example_steps import step_database_list +from .example_steps import step_database_update +from .example_steps import step_database_export +from .example_steps import step_database_import +from .example_steps import step_database_list_key +from .example_steps import step_database_regenerate_key +from .example_steps import step_database_delete +from .example_steps import step_operation_status_show +from .example_steps import step_private_endpoint_connection_put +from .example_steps import step_private_endpoint_connection_show +from .example_steps import step_private_endpoint_connection_list +from .example_steps import step_private_endpoint_connection_delete +from .example_steps import step_private_link_resource_list +from .example_steps import step_create +from .example_steps import step_show +from .example_steps import step_list +from .example_steps import step_list2 +from .example_steps import step_update +from .example_steps import step_delete +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, rg): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg): + setup_scenario(test, rg) + step_database_create(test, rg, checks=[]) + step_database_show(test, rg, checks=[]) + step_database_list(test, rg, checks=[]) + step_database_update(test, rg, checks=[]) + step_database_export(test, rg, checks=[]) + step_database_import(test, rg, checks=[]) + step_database_list_key(test, rg, checks=[]) + step_database_regenerate_key(test, rg, checks=[]) + step_database_delete(test, rg, checks=[]) + step_operation_status_show(test, rg, checks=[]) + step_private_endpoint_connection_put(test, rg, checks=[]) + step_private_endpoint_connection_show(test, rg, checks=[ + test.check("name", "{myPrivateEndpointConnection}", case_sensitive=False), + ]) + step_private_endpoint_connection_list(test, rg, checks=[ + test.check('length(@)', 1), + ]) + step_private_endpoint_connection_delete(test, rg, checks=[]) + step_private_link_resource_list(test, rg, checks=[]) + step_create(test, rg, checks=[]) + step_show(test, rg, checks=[]) + step_list(test, rg, checks=[]) + step_list2(test, rg, checks=[]) + step_update(test, rg, checks=[]) + step_delete(test, rg, checks=[]) + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class RedisenterpriseScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(RedisenterpriseScenarioTest, self).__init__(*args, **kwargs) + self.kwargs.update({ + 'myPrivateEndpointConnection': 'pectest01', + }) + + + @ResourceGroupPreparer(name_prefix='clitestredisenterprise_rg1'[:7], key='rg', parameter_name='rg') + def test_redisenterprise_Scenario(self, rg): + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() + diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/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/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/__init__.py new file mode 100644 index 00000000000..f5ea9b08fcc --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/__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 ._redis_enterprise_management_client import RedisEnterpriseManagementClient +__all__ = ['RedisEnterpriseManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_configuration.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_configuration.py new file mode 100644 index 00000000000..f2f3cdbde60 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_configuration.py @@ -0,0 +1,70 @@ +# 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 RedisEnterpriseManagementClientConfiguration(Configuration): + """Configuration for RedisEnterpriseManagementClient. + + 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 + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(RedisEnterpriseManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'redisenterprisemanagementclient/{}'.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/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_redis_enterprise_management_client.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_redis_enterprise_management_client.py new file mode 100644 index 00000000000..e0c1ddfd7d6 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/_redis_enterprise_management_client.py @@ -0,0 +1,94 @@ +# 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 RedisEnterpriseManagementClientConfiguration +from .operations import Operations +from .operations import OperationsStatusOperations +from .operations import RedisEnterpriseOperations +from .operations import DatabasesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from . import models + + +class RedisEnterpriseManagementClient(object): + """REST API for managing Redis Enterprise resources in Azure. + + :ivar operations: Operations operations + :vartype operations: redis_enterprise_management_client.operations.Operations + :ivar operations_status: OperationsStatusOperations operations + :vartype operations_status: redis_enterprise_management_client.operations.OperationsStatusOperations + :ivar redis_enterprise: RedisEnterpriseOperations operations + :vartype redis_enterprise: redis_enterprise_management_client.operations.RedisEnterpriseOperations + :ivar databases: DatabasesOperations operations + :vartype databases: redis_enterprise_management_client.operations.DatabasesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: redis_enterprise_management_client.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: redis_enterprise_management_client.operations.PrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :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" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = RedisEnterpriseManagementClientConfiguration(credential, subscription_id, **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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.redis_enterprise = RedisEnterpriseOperations( + self._client, self._config, self._serialize, self._deserialize) + self.databases = DatabasesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> RedisEnterpriseManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/__init__.py new file mode 100644 index 00000000000..e8b4634f34b --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/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 ._redis_enterprise_management_client import RedisEnterpriseManagementClient +__all__ = ['RedisEnterpriseManagementClient'] diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_configuration.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_configuration.py new file mode 100644 index 00000000000..c9281d936b0 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 RedisEnterpriseManagementClientConfiguration(Configuration): + """Configuration for RedisEnterpriseManagementClient. + + 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 + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(RedisEnterpriseManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-03-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'redisenterprisemanagementclient/{}'.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/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_redis_enterprise_management_client.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_redis_enterprise_management_client.py new file mode 100644 index 00000000000..63eab012701 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/_redis_enterprise_management_client.py @@ -0,0 +1,88 @@ +# 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 RedisEnterpriseManagementClientConfiguration +from .operations import Operations +from .operations import OperationsStatusOperations +from .operations import RedisEnterpriseOperations +from .operations import DatabasesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .. import models + + +class RedisEnterpriseManagementClient(object): + """REST API for managing Redis Enterprise resources in Azure. + + :ivar operations: Operations operations + :vartype operations: redis_enterprise_management_client.aio.operations.Operations + :ivar operations_status: OperationsStatusOperations operations + :vartype operations_status: redis_enterprise_management_client.aio.operations.OperationsStatusOperations + :ivar redis_enterprise: RedisEnterpriseOperations operations + :vartype redis_enterprise: redis_enterprise_management_client.aio.operations.RedisEnterpriseOperations + :ivar databases: DatabasesOperations operations + :vartype databases: redis_enterprise_management_client.aio.operations.DatabasesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: redis_enterprise_management_client.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: redis_enterprise_management_client.aio.operations.PrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :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", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = RedisEnterpriseManagementClientConfiguration(credential, subscription_id, **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.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.operations_status = OperationsStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.redis_enterprise = RedisEnterpriseOperations( + self._client, self._config, self._serialize, self._deserialize) + self.databases = DatabasesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "RedisEnterpriseManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/__init__.py new file mode 100644 index 00000000000..1847039b4da --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._operations import Operations +from ._operations_status_operations import OperationsStatusOperations +from ._redis_enterprise_operations import RedisEnterpriseOperations +from ._databases_operations import DatabasesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'OperationsStatusOperations', + 'RedisEnterpriseOperations', + 'DatabasesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', +] diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_databases_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_databases_operations.py new file mode 100644 index 00000000000..b1715b27e44 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_databases_operations.py @@ -0,0 +1,1017 @@ +# 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 DatabasesOperations: + """DatabasesOperations 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: ~redis_enterprise_management_client.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_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["models.DatabaseList"]: + """Gets all databases in the specified RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatabaseList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.DatabaseList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + 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('DatabaseList', 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.ErrorResponse, 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_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.Database", + **kwargs + ) -> "models.Database": + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'Database') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.Database", + **kwargs + ) -> AsyncLROPoller["models.Database"]: + """Creates a database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Parameters supplied to the create or update database operation. + :type parameters: ~redis_enterprise_management_client.models.Database + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.DatabaseUpdate", + **kwargs + ) -> Optional["models.Database"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Database"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'DatabaseUpdate') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.DatabaseUpdate", + **kwargs + ) -> AsyncLROPoller["models.Database"]: + """Updates a database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Parameters supplied to the create or update database operation. + :type parameters: ~redis_enterprise_management_client.models.DatabaseUpdate + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + 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_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> "models.Database": + """Gets information about a database in a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Database, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a single database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + async def list_keys( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> "models.AccessKeys": + """Retrieves the access keys for the RedisEnterprise database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/listKeys'} # type: ignore + + async def _regenerate_key_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.RegenerateKeyParameters", + **kwargs + ) -> Optional["models.AccessKeys"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AccessKeys"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._regenerate_key_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'RegenerateKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey'} # type: ignore + + async def begin_regenerate_key( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.RegenerateKeyParameters", + **kwargs + ) -> AsyncLROPoller["models.AccessKeys"]: + """Regenerates the RedisEnterprise database's access keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Specifies which key to regenerate. + :type parameters: ~redis_enterprise_management_client.models.RegenerateKeyParameters + :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 AccessKeys or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.AccessKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AccessKeys"] + 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._regenerate_key_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey'} # type: ignore + + async def _import_method_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.ImportClusterParameters", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._import_method_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ImportClusterParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_method_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import'} # type: ignore + + async def begin_import_method( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.ImportClusterParameters", + **kwargs + ) -> AsyncLROPoller[None]: + """Imports a database file to target database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Storage information for importing into the cluster. + :type parameters: ~redis_enterprise_management_client.models.ImportClusterParameters + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._import_method_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import'} # type: ignore + + async def _export_initial( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.ExportClusterParameters", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ExportClusterParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _export_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export'} # type: ignore + + async def begin_export( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.ExportClusterParameters", + **kwargs + ) -> AsyncLROPoller[None]: + """Exports a database file from target database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Storage information for exporting into the cluster. + :type parameters: ~redis_enterprise_management_client.models.ExportClusterParameters + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._export_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations.py new file mode 100644 index 00000000000..45ff2310249 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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 Operations: + """Operations 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: ~redis_enterprise_management_client.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.OperationListResult"]: + """Lists all of the available REST API operations of the Microsoft.Cache provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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('OperationListResult', 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.ErrorResponse, 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.Cache/operations'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations_status_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations_status_operations.py new file mode 100644 index 00000000000..8f8334874de --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_operations_status_operations.py @@ -0,0 +1,100 @@ +# 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 OperationsStatusOperations: + """OperationsStatusOperations 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: ~redis_enterprise_management_client.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, + location: str, + operation_id: str, + **kwargs + ) -> "models.OperationStatus": + """Gets the status of operation. + + :param location: The region the operation is in. + :type location: str + :param operation_id: The operation's unique identifier. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId}'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_endpoint_connections_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 00000000000..5a4161adacf --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,378 @@ +# 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 PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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: ~redis_enterprise_management_client.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, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["models.PrivateEndpointConnectionListResult"]: + """Lists all the private endpoint connections associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _put_initial( + self, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + 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(properties, 'PrivateEndpointConnection') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_put( + self, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~redis_enterprise_management_client.models.PrivateEndpointConnection + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + 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._put_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, 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_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> None: + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + 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.delete(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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_link_resources_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_link_resources_operations.py new file mode 100644 index 00000000000..0a052b9df1d --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,117 @@ +# 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 PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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: ~redis_enterprise_management_client.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_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["models.PrivateLinkResourceListResult"]: + """Gets the private link resources that need to be created for a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, 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_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateLinkResources'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_redis_enterprise_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_redis_enterprise_operations.py new file mode 100644 index 00000000000..93fc01ff0e9 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/aio/operations/_redis_enterprise_operations.py @@ -0,0 +1,606 @@ +# 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 RedisEnterpriseOperations: + """RedisEnterpriseOperations 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: ~redis_enterprise_management_client.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 _create_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: "models.Cluster", + **kwargs + ) -> "models.Cluster": + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'Cluster') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + cluster_name: str, + parameters: "models.Cluster", + **kwargs + ) -> AsyncLROPoller["models.Cluster"]: + """Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param parameters: Parameters supplied to the Create RedisEnterprise operation. + :type parameters: ~redis_enterprise_management_client.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: "models.ClusterUpdate", + **kwargs + ) -> Optional["models.Cluster"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ClusterUpdate') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: "models.ClusterUpdate", + **kwargs + ) -> AsyncLROPoller["models.Cluster"]: + """Updates an existing RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param parameters: Parameters supplied to the Update RedisEnterprise operation. + :type parameters: ~redis_enterprise_management_client.models.ClusterUpdate + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~redis_enterprise_management_client.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + 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_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a RedisEnterprise cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "models.Cluster": + """Gets information about a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.ClusterList"]: + """Lists all RedisEnterprise clusters in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('ClusterList', 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.ErrorResponse, 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["models.ClusterList"]: + """Gets all RedisEnterprise clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~redis_enterprise_management_client.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('ClusterList', 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.ErrorResponse, 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': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/__init__.py new file mode 100644 index 00000000000..d523be3efff --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/__init__.py @@ -0,0 +1,131 @@ +# 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 AccessKeys + from ._models_py3 import Cluster + from ._models_py3 import ClusterList + from ._models_py3 import ClusterUpdate + from ._models_py3 import Database + from ._models_py3 import DatabaseList + from ._models_py3 import DatabaseUpdate + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ExportClusterParameters + from ._models_py3 import ImportClusterParameters + from ._models_py3 import Module + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import OperationStatus + from ._models_py3 import Persistence + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateKeyParameters + from ._models_py3 import Resource + from ._models_py3 import Sku + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import AccessKeys # type: ignore + from ._models import Cluster # type: ignore + from ._models import ClusterList # type: ignore + from ._models import ClusterUpdate # type: ignore + from ._models import Database # type: ignore + from ._models import DatabaseList # type: ignore + from ._models import DatabaseUpdate # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExportClusterParameters # type: ignore + from ._models import ImportClusterParameters # type: ignore + from ._models import Module # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationStatus # type: ignore + from ._models import Persistence # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateKeyParameters # type: ignore + from ._models import Resource # type: ignore + from ._models import Sku # type: ignore + from ._models import TrackedResource # type: ignore + +from ._redis_enterprise_management_client_enums import ( + AccessKeyType, + ActionType, + AofFrequency, + ClusteringPolicy, + EvictionPolicy, + Origin, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + Protocol, + ProvisioningState, + RdbFrequency, + ResourceState, + SkuName, + TlsVersion, +) + +__all__ = [ + 'AccessKeys', + 'Cluster', + 'ClusterList', + 'ClusterUpdate', + 'Database', + 'DatabaseList', + 'DatabaseUpdate', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExportClusterParameters', + 'ImportClusterParameters', + 'Module', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'OperationStatus', + 'Persistence', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'ProxyResource', + 'RegenerateKeyParameters', + 'Resource', + 'Sku', + 'TrackedResource', + 'AccessKeyType', + 'ActionType', + 'AofFrequency', + 'ClusteringPolicy', + 'EvictionPolicy', + 'Origin', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'Protocol', + 'ProvisioningState', + 'RdbFrequency', + 'ResourceState', + 'SkuName', + 'TlsVersion', +] diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models.py new file mode 100644 index 00000000000..7a6685b75e0 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models.py @@ -0,0 +1,1137 @@ +# 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 AccessKeys(msrest.serialization.Model): + """The secret access keys used for authenticating connections to redis. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_key: The current primary key that clients can use to authenticate. + :vartype primary_key: str + :ivar secondary_key: The current secondary key that clients can use to authenticate. + :vartype secondary_key: str + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_key = None + self.secondary_key = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class Cluster(TrackedResource): + """Describes the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU to create, which affects price, performance, and features. + :type sku: ~redis_enterprise_management_client.models.Sku + :param zones: The Availability Zones where this cluster will be deployed. + :type zones: list[str] + :param minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Possible values include: "1.0", "1.1", "1.2". + :type minimum_tls_version: str or ~redis_enterprise_management_client.models.TlsVersion + :ivar host_name: DNS name of the cluster endpoint. + :vartype host_name: str + :ivar provisioning_state: Current provisioning status of the cluster. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the cluster. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :ivar redis_version: Version of redis the cluster supports, e.g. '6'. + :vartype redis_version: str + :ivar private_endpoint_connections: List of private endpoint connections associated with the + specified RedisEnterprise cluster. + :vartype private_endpoint_connections: + list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'host_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'redis_version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(Cluster, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.zones = kwargs.get('zones', None) + self.minimum_tls_version = kwargs.get('minimum_tls_version', None) + self.host_name = None + self.provisioning_state = None + self.resource_state = None + self.redis_version = None + self.private_endpoint_connections = None + + +class ClusterList(msrest.serialization.Model): + """The response of a list-all operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of clusters. + :type value: list[~redis_enterprise_management_client.models.Cluster] + :ivar next_link: The URI to fetch the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ClusterUpdate(msrest.serialization.Model): + """A partial update to the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param sku: The SKU to create, which affects price, performance, and features. + :type sku: ~redis_enterprise_management_client.models.Sku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Possible values include: "1.0", "1.1", "1.2". + :type minimum_tls_version: str or ~redis_enterprise_management_client.models.TlsVersion + :ivar host_name: DNS name of the cluster endpoint. + :vartype host_name: str + :ivar provisioning_state: Current provisioning status of the cluster. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the cluster. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :ivar redis_version: Version of redis the cluster supports, e.g. '6'. + :vartype redis_version: str + :ivar private_endpoint_connections: List of private endpoint connections associated with the + specified RedisEnterprise cluster. + :vartype private_endpoint_connections: + list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _validation = { + 'host_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'redis_version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.minimum_tls_version = kwargs.get('minimum_tls_version', None) + self.host_name = None + self.provisioning_state = None + self.resource_state = None + self.redis_version = None + self.private_endpoint_connections = None + + +class Database(Resource): + """Describes a database on the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param client_protocol: Specifies whether redis clients can connect using TLS-encrypted or + plaintext redis protocols. Default is TLS-encrypted. Possible values include: "Encrypted", + "Plaintext". + :type client_protocol: str or ~redis_enterprise_management_client.models.Protocol + :param port: TCP port of the database endpoint. Specified at create time. Defaults to an + available port. + :type port: int + :ivar provisioning_state: Current provisioning status of the database. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the database. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :param clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Possible values include: "EnterpriseCluster", "OSSCluster". + :type clustering_policy: str or ~redis_enterprise_management_client.models.ClusteringPolicy + :param eviction_policy: Redis eviction policy - default is VolatileLRU. Possible values + include: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", + "VolatileTTL", "VolatileRandom", "NoEviction". + :type eviction_policy: str or ~redis_enterprise_management_client.models.EvictionPolicy + :param persistence: Persistence settings. + :type persistence: ~redis_enterprise_management_client.models.Persistence + :param modules: Optional set of redis modules to enable in this database - modules can only be + added at creation time. + :type modules: list[~redis_enterprise_management_client.models.Module] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'client_protocol': {'key': 'properties.clientProtocol', 'type': 'str'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'clustering_policy': {'key': 'properties.clusteringPolicy', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'persistence': {'key': 'properties.persistence', 'type': 'Persistence'}, + 'modules': {'key': 'properties.modules', 'type': '[Module]'}, + } + + def __init__( + self, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.client_protocol = kwargs.get('client_protocol', None) + self.port = kwargs.get('port', None) + self.provisioning_state = None + self.resource_state = None + self.clustering_policy = kwargs.get('clustering_policy', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.persistence = kwargs.get('persistence', None) + self.modules = kwargs.get('modules', None) + + +class DatabaseList(msrest.serialization.Model): + """The response of a list-all operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of databases. + :type value: list[~redis_enterprise_management_client.models.Database] + :ivar next_link: The URI to fetch the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DatabaseUpdate(msrest.serialization.Model): + """A partial update to the RedisEnterprise database. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param client_protocol: Specifies whether redis clients can connect using TLS-encrypted or + plaintext redis protocols. Default is TLS-encrypted. Possible values include: "Encrypted", + "Plaintext". + :type client_protocol: str or ~redis_enterprise_management_client.models.Protocol + :param port: TCP port of the database endpoint. Specified at create time. Defaults to an + available port. + :type port: int + :ivar provisioning_state: Current provisioning status of the database. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the database. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :param clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Possible values include: "EnterpriseCluster", "OSSCluster". + :type clustering_policy: str or ~redis_enterprise_management_client.models.ClusteringPolicy + :param eviction_policy: Redis eviction policy - default is VolatileLRU. Possible values + include: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", + "VolatileTTL", "VolatileRandom", "NoEviction". + :type eviction_policy: str or ~redis_enterprise_management_client.models.EvictionPolicy + :param persistence: Persistence settings. + :type persistence: ~redis_enterprise_management_client.models.Persistence + :param modules: Optional set of redis modules to enable in this database - modules can only be + added at creation time. + :type modules: list[~redis_enterprise_management_client.models.Module] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + } + + _attribute_map = { + 'client_protocol': {'key': 'properties.clientProtocol', 'type': 'str'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'clustering_policy': {'key': 'properties.clusteringPolicy', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'persistence': {'key': 'properties.persistence', 'type': 'Persistence'}, + 'modules': {'key': 'properties.modules', 'type': '[Module]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseUpdate, self).__init__(**kwargs) + self.client_protocol = kwargs.get('client_protocol', None) + self.port = kwargs.get('port', None) + self.provisioning_state = None + self.resource_state = None + self.clustering_policy = kwargs.get('clustering_policy', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.persistence = kwargs.get('persistence', None) + self.modules = kwargs.get('modules', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~redis_enterprise_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~redis_enterprise_management_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~redis_enterprise_management_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ExportClusterParameters(msrest.serialization.Model): + """Parameters for a Redis Enterprise export operation. + + All required parameters must be populated in order to send to Azure. + + :param sas_uri: Required. SAS URI for the target directory to export to. + :type sas_uri: str + """ + + _validation = { + 'sas_uri': {'required': True}, + } + + _attribute_map = { + 'sas_uri': {'key': 'sasUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportClusterParameters, self).__init__(**kwargs) + self.sas_uri = kwargs['sas_uri'] + + +class ImportClusterParameters(msrest.serialization.Model): + """Parameters for a Redis Enterprise import operation. + + All required parameters must be populated in order to send to Azure. + + :param sas_uri: Required. SAS URI for the target blob to import from. + :type sas_uri: str + """ + + _validation = { + 'sas_uri': {'required': True}, + } + + _attribute_map = { + 'sas_uri': {'key': 'sasUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportClusterParameters, self).__init__(**kwargs) + self.sas_uri = kwargs['sas_uri'] + + +class Module(msrest.serialization.Model): + """Specifies configuration of a redis module. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the module, e.g. 'RedisBloom', 'RediSearch', + 'RedisTimeSeries'. + :type name: str + :param args: Configuration options for the module, e.g. 'ERROR_RATE 0.00 INITIAL_SIZE 400'. + :type args: str + :ivar version: The version of the module, e.g. '1.0'. + :vartype version: str + """ + + _validation = { + 'name': {'required': True}, + 'version': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'args': {'key': 'args', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Module, self).__init__(**kwargs) + self.name = kwargs['name'] + self.args = kwargs.get('args', None) + self.version = None + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~redis_enterprise_management_client.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~redis_enterprise_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~redis_enterprise_management_client.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = kwargs.get('display', None) + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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 = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~redis_enterprise_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatus(msrest.serialization.Model): + """The status of a long-running operation. + + :param id: The operation's unique id. + :type id: str + :param name: The operation's name. + :type name: str + :param start_time: The start time of the operation. + :type start_time: str + :param end_time: The end time of the operation. + :type end_time: str + :param status: The current status of the operation. + :type status: str + :param error: Error response describing why the operation failed. + :type error: ~redis_enterprise_management_client.models.ErrorResponse + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationStatus, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) + + +class Persistence(msrest.serialization.Model): + """Persistence-related configuration for the RedisEnterprise database. + + :param aof_enabled: Sets whether AOF is enabled. + :type aof_enabled: bool + :param rdb_enabled: Sets whether RDB is enabled. + :type rdb_enabled: bool + :param aof_frequency: Sets the frequency at which data is written to disk. Possible values + include: "1s", "always". + :type aof_frequency: str or ~redis_enterprise_management_client.models.AofFrequency + :param rdb_frequency: Sets the frequency at which a snapshot of the database is created. + Possible values include: "1h", "6h", "12h". + :type rdb_frequency: str or ~redis_enterprise_management_client.models.RdbFrequency + """ + + _attribute_map = { + 'aof_enabled': {'key': 'aofEnabled', 'type': 'bool'}, + 'rdb_enabled': {'key': 'rdbEnabled', 'type': 'bool'}, + 'aof_frequency': {'key': 'aofFrequency', 'type': 'str'}, + 'rdb_frequency': {'key': 'rdbFrequency', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Persistence, self).__init__(**kwargs) + self.aof_enabled = kwargs.get('aof_enabled', None) + self.rdb_enabled = kwargs.get('rdb_enabled', None) + self.aof_frequency = kwargs.get('aof_frequency', None) + self.rdb_frequency = kwargs.get('rdb_frequency', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~redis_enterprise_management_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~redis_enterprise_management_client.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :param value: Array of private endpoint connections. + :type value: list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~redis_enterprise_management_client.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or + ~redis_enterprise_management_client.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(ProxyResource, self).__init__(**kwargs) + + +class RegenerateKeyParameters(msrest.serialization.Model): + """Specifies which access keys to reset to a new random value. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. Which access key to regenerate. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~redis_enterprise_management_client.models.AccessKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + + +class Sku(msrest.serialization.Model): + """SKU parameters supplied to the create RedisEnterprise operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The type of RedisEnterprise cluster to deploy. Possible values: + (Enterprise_E10, EnterpriseFlash_F300 etc.). Possible values include: "Enterprise_E10", + "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", + "EnterpriseFlash_F700", "EnterpriseFlash_F1500". + :type name: str or ~redis_enterprise_management_client.models.SkuName + :param capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. + Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.capacity = kwargs.get('capacity', None) diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models_py3.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models_py3.py new file mode 100644 index 00000000000..de1ff810d22 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models_py3.py @@ -0,0 +1,1213 @@ +# 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 Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._redis_enterprise_management_client_enums import * + + +class AccessKeys(msrest.serialization.Model): + """The secret access keys used for authenticating connections to redis. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_key: The current primary key that clients can use to authenticate. + :vartype primary_key: str + :ivar secondary_key: The current secondary key that clients can use to authenticate. + :vartype secondary_key: str + """ + + _validation = { + 'primary_key': {'readonly': True}, + 'secondary_key': {'readonly': True}, + } + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessKeys, self).__init__(**kwargs) + self.primary_key = None + self.secondary_key = None + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Cluster(TrackedResource): + """Describes the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU to create, which affects price, performance, and features. + :type sku: ~redis_enterprise_management_client.models.Sku + :param zones: The Availability Zones where this cluster will be deployed. + :type zones: list[str] + :param minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Possible values include: "1.0", "1.1", "1.2". + :type minimum_tls_version: str or ~redis_enterprise_management_client.models.TlsVersion + :ivar host_name: DNS name of the cluster endpoint. + :vartype host_name: str + :ivar provisioning_state: Current provisioning status of the cluster. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the cluster. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :ivar redis_version: Version of redis the cluster supports, e.g. '6'. + :vartype redis_version: str + :ivar private_endpoint_connections: List of private endpoint connections associated with the + specified RedisEnterprise cluster. + :vartype private_endpoint_connections: + list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'host_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'redis_version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, + **kwargs + ): + super(Cluster, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.zones = zones + self.minimum_tls_version = minimum_tls_version + self.host_name = None + self.provisioning_state = None + self.resource_state = None + self.redis_version = None + self.private_endpoint_connections = None + + +class ClusterList(msrest.serialization.Model): + """The response of a list-all operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of clusters. + :type value: list[~redis_enterprise_management_client.models.Cluster] + :ivar next_link: The URI to fetch the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Cluster"]] = None, + **kwargs + ): + super(ClusterList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ClusterUpdate(msrest.serialization.Model): + """A partial update to the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param sku: The SKU to create, which affects price, performance, and features. + :type sku: ~redis_enterprise_management_client.models.Sku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. + Possible values include: "1.0", "1.1", "1.2". + :type minimum_tls_version: str or ~redis_enterprise_management_client.models.TlsVersion + :ivar host_name: DNS name of the cluster endpoint. + :vartype host_name: str + :ivar provisioning_state: Current provisioning status of the cluster. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the cluster. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :ivar redis_version: Version of redis the cluster supports, e.g. '6'. + :vartype redis_version: str + :ivar private_endpoint_connections: List of private endpoint connections associated with the + specified RedisEnterprise cluster. + :vartype private_endpoint_connections: + list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _validation = { + 'host_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + 'redis_version': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'minimum_tls_version': {'key': 'properties.minimumTlsVersion', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'redis_version': {'key': 'properties.redisVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + sku: Optional["Sku"] = None, + tags: Optional[Dict[str, str]] = None, + minimum_tls_version: Optional[Union[str, "TlsVersion"]] = None, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.sku = sku + self.tags = tags + self.minimum_tls_version = minimum_tls_version + self.host_name = None + self.provisioning_state = None + self.resource_state = None + self.redis_version = None + self.private_endpoint_connections = None + + +class Database(Resource): + """Describes a database on the RedisEnterprise cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param client_protocol: Specifies whether redis clients can connect using TLS-encrypted or + plaintext redis protocols. Default is TLS-encrypted. Possible values include: "Encrypted", + "Plaintext". + :type client_protocol: str or ~redis_enterprise_management_client.models.Protocol + :param port: TCP port of the database endpoint. Specified at create time. Defaults to an + available port. + :type port: int + :ivar provisioning_state: Current provisioning status of the database. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the database. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :param clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Possible values include: "EnterpriseCluster", "OSSCluster". + :type clustering_policy: str or ~redis_enterprise_management_client.models.ClusteringPolicy + :param eviction_policy: Redis eviction policy - default is VolatileLRU. Possible values + include: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", + "VolatileTTL", "VolatileRandom", "NoEviction". + :type eviction_policy: str or ~redis_enterprise_management_client.models.EvictionPolicy + :param persistence: Persistence settings. + :type persistence: ~redis_enterprise_management_client.models.Persistence + :param modules: Optional set of redis modules to enable in this database - modules can only be + added at creation time. + :type modules: list[~redis_enterprise_management_client.models.Module] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'client_protocol': {'key': 'properties.clientProtocol', 'type': 'str'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'clustering_policy': {'key': 'properties.clusteringPolicy', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'persistence': {'key': 'properties.persistence', 'type': 'Persistence'}, + 'modules': {'key': 'properties.modules', 'type': '[Module]'}, + } + + def __init__( + self, + *, + client_protocol: Optional[Union[str, "Protocol"]] = None, + port: Optional[int] = None, + clustering_policy: Optional[Union[str, "ClusteringPolicy"]] = None, + eviction_policy: Optional[Union[str, "EvictionPolicy"]] = None, + persistence: Optional["Persistence"] = None, + modules: Optional[List["Module"]] = None, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.client_protocol = client_protocol + self.port = port + self.provisioning_state = None + self.resource_state = None + self.clustering_policy = clustering_policy + self.eviction_policy = eviction_policy + self.persistence = persistence + self.modules = modules + + +class DatabaseList(msrest.serialization.Model): + """The response of a list-all operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of databases. + :type value: list[~redis_enterprise_management_client.models.Database] + :ivar next_link: The URI to fetch the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Database"]] = None, + **kwargs + ): + super(DatabaseList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DatabaseUpdate(msrest.serialization.Model): + """A partial update to the RedisEnterprise database. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param client_protocol: Specifies whether redis clients can connect using TLS-encrypted or + plaintext redis protocols. Default is TLS-encrypted. Possible values include: "Encrypted", + "Plaintext". + :type client_protocol: str or ~redis_enterprise_management_client.models.Protocol + :param port: TCP port of the database endpoint. Specified at create time. Defaults to an + available port. + :type port: int + :ivar provisioning_state: Current provisioning status of the database. Possible values include: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.ProvisioningState + :ivar resource_state: Current resource status of the database. Possible values include: + "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", + "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled". + :vartype resource_state: str or ~redis_enterprise_management_client.models.ResourceState + :param clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Possible values include: "EnterpriseCluster", "OSSCluster". + :type clustering_policy: str or ~redis_enterprise_management_client.models.ClusteringPolicy + :param eviction_policy: Redis eviction policy - default is VolatileLRU. Possible values + include: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", + "VolatileTTL", "VolatileRandom", "NoEviction". + :type eviction_policy: str or ~redis_enterprise_management_client.models.EvictionPolicy + :param persistence: Persistence settings. + :type persistence: ~redis_enterprise_management_client.models.Persistence + :param modules: Optional set of redis modules to enable in this database - modules can only be + added at creation time. + :type modules: list[~redis_enterprise_management_client.models.Module] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_state': {'readonly': True}, + } + + _attribute_map = { + 'client_protocol': {'key': 'properties.clientProtocol', 'type': 'str'}, + 'port': {'key': 'properties.port', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_state': {'key': 'properties.resourceState', 'type': 'str'}, + 'clustering_policy': {'key': 'properties.clusteringPolicy', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'persistence': {'key': 'properties.persistence', 'type': 'Persistence'}, + 'modules': {'key': 'properties.modules', 'type': '[Module]'}, + } + + def __init__( + self, + *, + client_protocol: Optional[Union[str, "Protocol"]] = None, + port: Optional[int] = None, + clustering_policy: Optional[Union[str, "ClusteringPolicy"]] = None, + eviction_policy: Optional[Union[str, "EvictionPolicy"]] = None, + persistence: Optional["Persistence"] = None, + modules: Optional[List["Module"]] = None, + **kwargs + ): + super(DatabaseUpdate, self).__init__(**kwargs) + self.client_protocol = client_protocol + self.port = port + self.provisioning_state = None + self.resource_state = None + self.clustering_policy = clustering_policy + self.eviction_policy = eviction_policy + self.persistence = persistence + self.modules = modules + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~redis_enterprise_management_client.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~redis_enterprise_management_client.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~redis_enterprise_management_client.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ExportClusterParameters(msrest.serialization.Model): + """Parameters for a Redis Enterprise export operation. + + All required parameters must be populated in order to send to Azure. + + :param sas_uri: Required. SAS URI for the target directory to export to. + :type sas_uri: str + """ + + _validation = { + 'sas_uri': {'required': True}, + } + + _attribute_map = { + 'sas_uri': {'key': 'sasUri', 'type': 'str'}, + } + + def __init__( + self, + *, + sas_uri: str, + **kwargs + ): + super(ExportClusterParameters, self).__init__(**kwargs) + self.sas_uri = sas_uri + + +class ImportClusterParameters(msrest.serialization.Model): + """Parameters for a Redis Enterprise import operation. + + All required parameters must be populated in order to send to Azure. + + :param sas_uri: Required. SAS URI for the target blob to import from. + :type sas_uri: str + """ + + _validation = { + 'sas_uri': {'required': True}, + } + + _attribute_map = { + 'sas_uri': {'key': 'sasUri', 'type': 'str'}, + } + + def __init__( + self, + *, + sas_uri: str, + **kwargs + ): + super(ImportClusterParameters, self).__init__(**kwargs) + self.sas_uri = sas_uri + + +class Module(msrest.serialization.Model): + """Specifies configuration of a redis module. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the module, e.g. 'RedisBloom', 'RediSearch', + 'RedisTimeSeries'. + :type name: str + :param args: Configuration options for the module, e.g. 'ERROR_RATE 0.00 INITIAL_SIZE 400'. + :type args: str + :ivar version: The version of the module, e.g. '1.0'. + :vartype version: str + """ + + _validation = { + 'name': {'required': True}, + 'version': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'args': {'key': 'args', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + args: Optional[str] = None, + **kwargs + ): + super(Module, self).__init__(**kwargs) + self.name = name + self.args = args + self.version = None + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data- + plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~redis_enterprise_management_client.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~redis_enterprise_management_client.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~redis_enterprise_management_client.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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 = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~redis_enterprise_management_client.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatus(msrest.serialization.Model): + """The status of a long-running operation. + + :param id: The operation's unique id. + :type id: str + :param name: The operation's name. + :type name: str + :param start_time: The start time of the operation. + :type start_time: str + :param end_time: The end time of the operation. + :type end_time: str + :param status: The current status of the operation. + :type status: str + :param error: Error response describing why the operation failed. + :type error: ~redis_enterprise_management_client.models.ErrorResponse + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + status: Optional[str] = None, + error: Optional["ErrorResponse"] = None, + **kwargs + ): + super(OperationStatus, self).__init__(**kwargs) + self.id = id + self.name = name + self.start_time = start_time + self.end_time = end_time + self.status = status + self.error = error + + +class Persistence(msrest.serialization.Model): + """Persistence-related configuration for the RedisEnterprise database. + + :param aof_enabled: Sets whether AOF is enabled. + :type aof_enabled: bool + :param rdb_enabled: Sets whether RDB is enabled. + :type rdb_enabled: bool + :param aof_frequency: Sets the frequency at which data is written to disk. Possible values + include: "1s", "always". + :type aof_frequency: str or ~redis_enterprise_management_client.models.AofFrequency + :param rdb_frequency: Sets the frequency at which a snapshot of the database is created. + Possible values include: "1h", "6h", "12h". + :type rdb_frequency: str or ~redis_enterprise_management_client.models.RdbFrequency + """ + + _attribute_map = { + 'aof_enabled': {'key': 'aofEnabled', 'type': 'bool'}, + 'rdb_enabled': {'key': 'rdbEnabled', 'type': 'bool'}, + 'aof_frequency': {'key': 'aofFrequency', 'type': 'str'}, + 'rdb_frequency': {'key': 'rdbFrequency', 'type': 'str'}, + } + + def __init__( + self, + *, + aof_enabled: Optional[bool] = None, + rdb_enabled: Optional[bool] = None, + aof_frequency: Optional[Union[str, "AofFrequency"]] = None, + rdb_frequency: Optional[Union[str, "RdbFrequency"]] = None, + **kwargs + ): + super(Persistence, self).__init__(**kwargs) + self.aof_enabled = aof_enabled + self.rdb_enabled = rdb_enabled + self.aof_frequency = aof_frequency + self.rdb_frequency = rdb_frequency + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~redis_enterprise_management_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~redis_enterprise_management_client.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~redis_enterprise_management_client.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :param value: Array of private endpoint connections. + :type value: list[~redis_enterprise_management_client.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~redis_enterprise_management_client.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or + ~redis_enterprise_management_client.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :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(ProxyResource, self).__init__(**kwargs) + + +class RegenerateKeyParameters(msrest.serialization.Model): + """Specifies which access keys to reset to a new random value. + + All required parameters must be populated in order to send to Azure. + + :param key_type: Required. Which access key to regenerate. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~redis_enterprise_management_client.models.AccessKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "AccessKeyType"], + **kwargs + ): + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = key_type + + +class Sku(msrest.serialization.Model): + """SKU parameters supplied to the create RedisEnterprise operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The type of RedisEnterprise cluster to deploy. Possible values: + (Enterprise_E10, EnterpriseFlash_F300 etc.). Possible values include: "Enterprise_E10", + "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "EnterpriseFlash_F300", + "EnterpriseFlash_F700", "EnterpriseFlash_F1500". + :type name: str or ~redis_enterprise_management_client.models.SkuName + :param capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. + Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.capacity = capacity diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_redis_enterprise_management_client_enums.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_redis_enterprise_management_client_enums.py new file mode 100644 index 00000000000..c19fa2c79c2 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_redis_enterprise_management_client_enums.py @@ -0,0 +1,158 @@ +# 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 AccessKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Which access key to regenerate. + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class AofFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sets the frequency at which data is written to disk. + """ + + ONE_S = "1s" + ALWAYS = "always" + +class ClusteringPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Clustering policy - default is OSSCluster. Specified at create time. + """ + + ENTERPRISE_CLUSTER = "EnterpriseCluster" + OSS_CLUSTER = "OSSCluster" + +class EvictionPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Redis eviction policy - default is VolatileLRU + """ + + ALL_KEYS_LFU = "AllKeysLFU" + ALL_KEYS_LRU = "AllKeysLRU" + ALL_KEYS_RANDOM = "AllKeysRandom" + VOLATILE_LRU = "VolatileLRU" + VOLATILE_LFU = "VolatileLFU" + VOLATILE_TTL = "VolatileTTL" + VOLATILE_RANDOM = "VolatileRandom" + NO_EVICTION = "NoEviction" + +class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class Protocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. + Default is TLS-encrypted. + """ + + ENCRYPTED = "Encrypted" + PLAINTEXT = "Plaintext" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current provisioning status + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class RdbFrequency(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sets the frequency at which a snapshot of the database is created. + """ + + ONE_H = "1h" + SIX_H = "6h" + TWELVE_H = "12h" + +class ResourceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Current resource status + """ + + RUNNING = "Running" + CREATING = "Creating" + CREATE_FAILED = "CreateFailed" + UPDATING = "Updating" + UPDATE_FAILED = "UpdateFailed" + DELETING = "Deleting" + DELETE_FAILED = "DeleteFailed" + ENABLING = "Enabling" + ENABLE_FAILED = "EnableFailed" + DISABLING = "Disabling" + DISABLE_FAILED = "DisableFailed" + DISABLED = "Disabled" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, + EnterpriseFlash_F300 etc.) + """ + + ENTERPRISE_E10 = "Enterprise_E10" + ENTERPRISE_E20 = "Enterprise_E20" + ENTERPRISE_E50 = "Enterprise_E50" + ENTERPRISE_E100 = "Enterprise_E100" + ENTERPRISE_FLASH_F300 = "EnterpriseFlash_F300" + ENTERPRISE_FLASH_F700 = "EnterpriseFlash_F700" + ENTERPRISE_FLASH_F1500 = "EnterpriseFlash_F1500" + +class TlsVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The minimum TLS version for the cluster to support, e.g. '1.2' + """ + + ONE0 = "1.0" + ONE1 = "1.1" + ONE2 = "1.2" diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/__init__.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/__init__.py new file mode 100644 index 00000000000..1847039b4da --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/__init__.py @@ -0,0 +1,23 @@ +# 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 ._operations import Operations +from ._operations_status_operations import OperationsStatusOperations +from ._redis_enterprise_operations import RedisEnterpriseOperations +from ._databases_operations import DatabasesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'OperationsStatusOperations', + 'RedisEnterpriseOperations', + 'DatabasesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', +] diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_databases_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_databases_operations.py new file mode 100644 index 00000000000..ae177a2fa3f --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_databases_operations.py @@ -0,0 +1,1036 @@ +# 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 DatabasesOperations(object): + """DatabasesOperations 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: ~redis_enterprise_management_client.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_by_cluster( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DatabaseList"] + """Gets all databases in the specified RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatabaseList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.DatabaseList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + 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('DatabaseList', 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.ErrorResponse, 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_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.Database" + **kwargs # type: Any + ): + # type: (...) -> "models.Database" + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'Database') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.Database" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Database"] + """Creates a database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Parameters supplied to the create or update database operation. + :type parameters: ~redis_enterprise_management_client.models.Database + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.DatabaseUpdate" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Database"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Database"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'DatabaseUpdate') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.DatabaseUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Database"] + """Updates a database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Parameters supplied to the create or update database operation. + :type parameters: ~redis_enterprise_management_client.models.DatabaseUpdate + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + 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_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Database" + """Gets information about a database in a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Database, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a single database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AccessKeys" + """Retrieves the access keys for the RedisEnterprise database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AccessKeys, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.AccessKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccessKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/listKeys'} # type: ignore + + def _regenerate_key_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.RegenerateKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.AccessKeys"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.AccessKeys"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._regenerate_key_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'RegenerateKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _regenerate_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey'} # type: ignore + + def begin_regenerate_key( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.RegenerateKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.AccessKeys"] + """Regenerates the RedisEnterprise database's access keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Specifies which key to regenerate. + :type parameters: ~redis_enterprise_management_client.models.RegenerateKeyParameters + :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 AccessKeys or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.AccessKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.AccessKeys"] + 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._regenerate_key_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + 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('AccessKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/regenerateKey'} # type: ignore + + def _import_method_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.ImportClusterParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._import_method_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ImportClusterParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _import_method_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import'} # type: ignore + + def begin_import_method( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.ImportClusterParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Imports a database file to target database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Storage information for importing into the cluster. + :type parameters: ~redis_enterprise_management_client.models.ImportClusterParameters + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._import_method_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/import'} # type: ignore + + def _export_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.ExportClusterParameters" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ExportClusterParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _export_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export'} # type: ignore + + def begin_export( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + parameters, # type: "models.ExportClusterParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Exports a database file from target database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: Storage information for exporting into the cluster. + :type parameters: ~redis_enterprise_management_client.models.ExportClusterParameters + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._export_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/export'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations.py new file mode 100644 index 00000000000..97f76140cd1 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 Operations(object): + """Operations 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: ~redis_enterprise_management_client.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.OperationListResult"] + """Lists all of the available REST API operations of the Microsoft.Cache provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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('OperationListResult', 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.ErrorResponse, 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.Cache/operations'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations_status_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations_status_operations.py new file mode 100644 index 00000000000..06328b6611c --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_operations_status_operations.py @@ -0,0 +1,105 @@ +# 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 OperationsStatusOperations(object): + """OperationsStatusOperations 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: ~redis_enterprise_management_client.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, + location, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.OperationStatus" + """Gets the status of operation. + + :param location: The region the operation is in. + :type location: str + :param operation_id: The operation's unique identifier. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatus, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.OperationStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId}'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_endpoint_connections_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_endpoint_connections_operations.py new file mode 100644 index 00000000000..4379a1e304a --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,387 @@ +# 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 PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations 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: ~redis_enterprise_management_client.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, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateEndpointConnectionListResult"] + """Lists all the private endpoint connections associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + """Gets the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _put_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + 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(properties, 'PrivateEndpointConnection') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_put( + self, + resource_group_name, # type: str + cluster_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~redis_enterprise_management_client.models.PrivateEndpointConnection + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + 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._put_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, 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_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + 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.delete(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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_link_resources_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_link_resources_operations.py new file mode 100644 index 00000000000..86db2fba907 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_private_link_resources_operations.py @@ -0,0 +1,122 @@ +# 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 PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations 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: ~redis_enterprise_management_client.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_by_cluster( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.PrivateLinkResourceListResult"] + """Gets the private link resources that need to be created for a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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.ErrorResponse, 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_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateLinkResources'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_redis_enterprise_operations.py b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_redis_enterprise_operations.py new file mode 100644 index 00000000000..08984f49fd1 --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/operations/_redis_enterprise_operations.py @@ -0,0 +1,619 @@ +# 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 RedisEnterpriseOperations(object): + """RedisEnterpriseOperations 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: ~redis_enterprise_management_client.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 _create_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> "models.Cluster" + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'Cluster') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Cluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "models.Cluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Cluster"] + """Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param parameters: Parameters supplied to the Create RedisEnterprise operation. + :type parameters: ~redis_enterprise_management_client.models.Cluster + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "models.ClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> Optional["models.Cluster"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.Cluster"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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(parameters, 'ClusterUpdate') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "models.ClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.Cluster"] + """Updates an existing RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :param parameters: Parameters supplied to the Update RedisEnterprise operation. + :type parameters: ~redis_enterprise_management_client.models.ClusterUpdate + :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 Cluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~redis_enterprise_management_client.models.Cluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + 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_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + 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('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a RedisEnterprise cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + 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._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, 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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Cluster" + """Gets information about a RedisEnterprise cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_name: The name of the RedisEnterprise cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cluster, or the result of cls(response) + :rtype: ~redis_enterprise_management_client.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ClusterList"] + """Lists all RedisEnterprise clusters in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('ClusterList', 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.ErrorResponse, 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ClusterList"] + """Gets all RedisEnterprise clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~redis_enterprise_management_client.models.ClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + 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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + 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('ClusterList', 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.ErrorResponse, 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': '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise'} # type: ignore diff --git a/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/py.typed b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/redisenterprise/report.md b/src/redisenterprise/report.md new file mode 100644 index 00000000000..ee12191efb5 --- /dev/null +++ b/src/redisenterprise/report.md @@ -0,0 +1,360 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az redisenterprise|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az redisenterprise` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az redisenterprise operation-status|OperationsStatus|[commands](#CommandsInOperationsStatus)| +|az redisenterprise|RedisEnterprise|[commands](#CommandsInRedisEnterprise)| +|az redisenterprise database|Databases|[commands](#CommandsInDatabases)| +|az redisenterprise private-endpoint-connection|PrivateEndpointConnections|[commands](#CommandsInPrivateEndpointConnections)| +|az redisenterprise private-link-resource|PrivateLinkResources|[commands](#CommandsInPrivateLinkResources)| + +## COMMANDS +### Commands in `az redisenterprise` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az redisenterprise list](#RedisEnterpriseListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersRedisEnterpriseListByResourceGroup)|[Example](#ExamplesRedisEnterpriseListByResourceGroup)| +|[az redisenterprise list](#RedisEnterpriseList)|List|[Parameters](#ParametersRedisEnterpriseList)|[Example](#ExamplesRedisEnterpriseList)| +|[az redisenterprise show](#RedisEnterpriseGet)|Get|[Parameters](#ParametersRedisEnterpriseGet)|[Example](#ExamplesRedisEnterpriseGet)| +|[az redisenterprise create](#RedisEnterpriseCreate)|Create|[Parameters](#ParametersRedisEnterpriseCreate)|[Example](#ExamplesRedisEnterpriseCreate)| +|[az redisenterprise update](#RedisEnterpriseUpdate)|Update|[Parameters](#ParametersRedisEnterpriseUpdate)|[Example](#ExamplesRedisEnterpriseUpdate)| +|[az redisenterprise delete](#RedisEnterpriseDelete)|Delete|[Parameters](#ParametersRedisEnterpriseDelete)|[Example](#ExamplesRedisEnterpriseDelete)| + +### Commands in `az redisenterprise database` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az redisenterprise database list](#DatabasesListByCluster)|ListByCluster|[Parameters](#ParametersDatabasesListByCluster)|[Example](#ExamplesDatabasesListByCluster)| +|[az redisenterprise database show](#DatabasesGet)|Get|[Parameters](#ParametersDatabasesGet)|[Example](#ExamplesDatabasesGet)| +|[az redisenterprise database create](#DatabasesCreate)|Create|[Parameters](#ParametersDatabasesCreate)|[Example](#ExamplesDatabasesCreate)| +|[az redisenterprise database update](#DatabasesUpdate)|Update|[Parameters](#ParametersDatabasesUpdate)|[Example](#ExamplesDatabasesUpdate)| +|[az redisenterprise database delete](#DatabasesDelete)|Delete|[Parameters](#ParametersDatabasesDelete)|[Example](#ExamplesDatabasesDelete)| +|[az redisenterprise database export](#DatabasesExport)|Export|[Parameters](#ParametersDatabasesExport)|[Example](#ExamplesDatabasesExport)| +|[az redisenterprise database import](#DatabasesImport)|Import|[Parameters](#ParametersDatabasesImport)|[Example](#ExamplesDatabasesImport)| +|[az redisenterprise database list-key](#DatabasesListKeys)|ListKeys|[Parameters](#ParametersDatabasesListKeys)|[Example](#ExamplesDatabasesListKeys)| +|[az redisenterprise database regenerate-key](#DatabasesRegenerateKey)|RegenerateKey|[Parameters](#ParametersDatabasesRegenerateKey)|[Example](#ExamplesDatabasesRegenerateKey)| + +### Commands in `az redisenterprise operation-status` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az redisenterprise operation-status show](#OperationsStatusGet)|Get|[Parameters](#ParametersOperationsStatusGet)|[Example](#ExamplesOperationsStatusGet)| + +### Commands in `az redisenterprise private-endpoint-connection` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az redisenterprise private-endpoint-connection list](#PrivateEndpointConnectionsList)|List|[Parameters](#ParametersPrivateEndpointConnectionsList)|[Example](#ExamplesPrivateEndpointConnectionsList)| +|[az redisenterprise private-endpoint-connection show](#PrivateEndpointConnectionsGet)|Get|[Parameters](#ParametersPrivateEndpointConnectionsGet)|[Example](#ExamplesPrivateEndpointConnectionsGet)| +|[az redisenterprise private-endpoint-connection delete](#PrivateEndpointConnectionsDelete)|Delete|[Parameters](#ParametersPrivateEndpointConnectionsDelete)|[Example](#ExamplesPrivateEndpointConnectionsDelete)| +|[az redisenterprise private-endpoint-connection put](#PrivateEndpointConnectionsPut)|Put|[Parameters](#ParametersPrivateEndpointConnectionsPut)|[Example](#ExamplesPrivateEndpointConnectionsPut)| + +### Commands in `az redisenterprise private-link-resource` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az redisenterprise private-link-resource list](#PrivateLinkResourcesListByCluster)|ListByCluster|[Parameters](#ParametersPrivateLinkResourcesListByCluster)|[Example](#ExamplesPrivateLinkResourcesListByCluster)| + + +## COMMAND DETAILS + +### group `az redisenterprise` +#### Command `az redisenterprise list` + +##### Example +``` +az redisenterprise list --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az redisenterprise list` + +##### Example +``` +az redisenterprise list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az redisenterprise show` + +##### Example +``` +az redisenterprise show --cluster-name "cache1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| + +#### Command `az redisenterprise create` + +##### Example +``` +az redisenterprise create --cluster-name "cache1" --location "West US" --minimum-tls-version "1.2" --sku \ +name="EnterpriseFlash_F300" capacity=3 --tags tag1="value1" --zones "1" "2" "3" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--sku**|object|The SKU to create, which affects price, performance, and features.|sku|sku| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--zones**|array|The Availability Zones where this cluster will be deployed.|zones|zones| +|**--minimum-tls-version**|choice|The minimum TLS version for the cluster to support, e.g. '1.2'|minimum_tls_version|minimumTlsVersion| + +#### Command `az redisenterprise update` + +##### Example +``` +az redisenterprise update --cluster-name "cache1" --minimum-tls-version "1.2" --sku name="EnterpriseFlash_F300" \ +capacity=9 --tags tag1="value1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--sku**|object|The SKU to create, which affects price, performance, and features.|sku|sku| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--minimum-tls-version**|choice|The minimum TLS version for the cluster to support, e.g. '1.2'|minimum_tls_version|minimumTlsVersion| + +#### Command `az redisenterprise delete` + +##### Example +``` +az redisenterprise delete --cluster-name "cache1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| + +### group `az redisenterprise database` +#### Command `az redisenterprise database list` + +##### Example +``` +az redisenterprise database list --cluster-name "cache1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| + +#### Command `az redisenterprise database show` + +##### Example +``` +az redisenterprise database show --cluster-name "cache1" --database-name "default" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| + +#### Command `az redisenterprise database create` + +##### Example +``` +az redisenterprise database create --cluster-name "cache1" --database-name "default" --client-protocol "Encrypted" \ +--clustering-policy "EnterpriseCluster" --eviction-policy "AllKeysLRU" --modules name="RedisBloom" args="ERROR_RATE \ +0.00 INITIAL_SIZE 400" --modules name="RedisTimeSeries" args="RETENTION_POLICY 20" --modules name="RediSearch" \ +--persistence aof-enabled=true aof-frequency="1s" --port 10000 --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| +|**--client-protocol**|choice|Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted.|client_protocol|clientProtocol| +|**--port**|integer|TCP port of the database endpoint. Specified at create time. Defaults to an available port.|port|port| +|**--clustering-policy**|choice|Clustering policy - default is OSSCluster. Specified at create time.|clustering_policy|clusteringPolicy| +|**--eviction-policy**|choice|Redis eviction policy - default is VolatileLRU|eviction_policy|evictionPolicy| +|**--persistence**|object|Persistence settings|persistence|persistence| +|**--modules**|array|Optional set of redis modules to enable in this database - modules can only be added at creation time.|modules|modules| + +#### Command `az redisenterprise database update` + +##### Example +``` +az redisenterprise database update --cluster-name "cache1" --database-name "default" --client-protocol "Encrypted" \ +--eviction-policy "AllKeysLRU" --persistence rdb-enabled=true rdb-frequency="12h" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| +|**--client-protocol**|choice|Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted.|client_protocol|clientProtocol| +|**--port**|integer|TCP port of the database endpoint. Specified at create time. Defaults to an available port.|port|port| +|**--clustering-policy**|choice|Clustering policy - default is OSSCluster. Specified at create time.|clustering_policy|clusteringPolicy| +|**--eviction-policy**|choice|Redis eviction policy - default is VolatileLRU|eviction_policy|evictionPolicy| +|**--persistence**|object|Persistence settings|persistence|persistence| +|**--modules**|array|Optional set of redis modules to enable in this database - modules can only be added at creation time.|modules|modules| + +#### Command `az redisenterprise database delete` + +##### Example +``` +az redisenterprise database delete --cluster-name "cache1" --database-name "db1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| + +#### Command `az redisenterprise database export` + +##### Example +``` +az redisenterprise database export --cluster-name "cache1" --database-name "default" --sas-uri \ +"https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| +|**--sas-uri**|string|SAS URI for the target directory to export to|sas_uri|sasUri| + +#### Command `az redisenterprise database import` + +##### Example +``` +az redisenterprise database import --cluster-name "cache1" --database-name "default" --sas-uri \ +"https://contosostorage.blob.core.window.net/urltoBlobFile?sasKeyParameters" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| +|**--sas-uri**|string|SAS URI for the target blob to import from|sas_uri|sasUri| + +#### Command `az redisenterprise database list-key` + +##### Example +``` +az redisenterprise database list-key --cluster-name "cache1" --database-name "default" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| + +#### Command `az redisenterprise database regenerate-key` + +##### Example +``` +az redisenterprise database regenerate-key --cluster-name "cache1" --database-name "default" --key-type "Primary" \ +--resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--database-name**|string|The name of the database.|database_name|databaseName| +|**--key-type**|sealed-choice|Which access key to regenerate.|key_type|keyType| + +### group `az redisenterprise operation-status` +#### Command `az redisenterprise operation-status show` + +##### Example +``` +az redisenterprise operation-status show --operation-id "testoperationid" --location "West US" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--location**|string|The region the operation is in.|location|location| +|**--operation-id**|string|The operation's unique identifier.|operation_id|operationId| + +### group `az redisenterprise private-endpoint-connection` +#### Command `az redisenterprise private-endpoint-connection list` + +##### Example +``` +az redisenterprise private-endpoint-connection list --cluster-name "cache1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| + +#### Command `az redisenterprise private-endpoint-connection show` + +##### Example +``` +az redisenterprise private-endpoint-connection show --cluster-name "cache1" --name "pectest01" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| + +#### Command `az redisenterprise private-endpoint-connection delete` + +##### Example +``` +az redisenterprise private-endpoint-connection delete --cluster-name "cache1" --name "pectest01" --resource-group \ +"rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| + +#### Command `az redisenterprise private-endpoint-connection put` + +##### Example +``` +az redisenterprise private-endpoint-connection put --cluster-name "cache1" --name "pectest01" \ +--private-link-service-connection-state description="Auto-Approved" status="Approved" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| +|**--private-endpoint-connection-name**|string|The name of the private endpoint connection associated with the Azure resource|private_endpoint_connection_name|privateEndpointConnectionName| +|**--private-link-service-connection-state**|object|A collection of information about the state of the connection between service consumer and provider.|private_link_service_connection_state|privateLinkServiceConnectionState| + +### group `az redisenterprise private-link-resource` +#### Command `az redisenterprise private-link-resource list` + +##### Example +``` +az redisenterprise private-link-resource list --cluster-name "cache1" --resource-group "rg1" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the RedisEnterprise cluster.|cluster_name|clusterName| diff --git a/src/redisenterprise/setup.cfg b/src/redisenterprise/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/redisenterprise/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/redisenterprise/setup.py b/src/redisenterprise/setup.py new file mode 100644 index 00000000000..bebe3fd5765 --- /dev/null +++ b/src/redisenterprise/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_redisenterprise.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_redisenterprise.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='redisenterprise', + version=VERSION, + description='Microsoft Azure Command-Line Tools RedisEnterpriseManagementClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/redisenterprise', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_redisenterprise': ['azext_metadata.json']}, +)