From 32b82b95dbeb2b54ae8776002cb74870a3bbb043 Mon Sep 17 00:00:00 2001 From: Arif-lakhani Date: Tue, 10 Oct 2023 19:08:13 -0700 Subject: [PATCH] K8s extension/release 1.5.0 (#6779) --- src/k8s-extension/HISTORY.rst | 6 + .../azext_k8s_extension/_client_factory.py | 16 +- .../azext_k8s_extension/_format.py | 32 +- .../azext_k8s_extension/_help.py | 72 +- .../azext_k8s_extension/_params.py | 41 +- .../azext_k8s_extension/commands.py | 41 +- .../azext_k8s_extension/consts.py | 2 +- .../azext_k8s_extension/custom.py | 187 +- .../partner_extensions/OpenServiceMesh.py | 5 +- .../latest/recordings/test_k8s_extension.yaml | 151 +- .../recordings/test_k8s_extension_types.yaml | 289 +- .../latest/test_k8s_extension_scenario.py | 2 +- .../test_k8s_extension_types_scenario.py | 40 +- .../vendored_sdks/_configuration.py | 6 +- .../vendored_sdks/_serialization.py | 688 ++-- .../_source_control_configuration_client.py | 56 +- .../vendored_sdks/_version.py | 7 +- .../vendored_sdks/models.py | 2 +- .../vendored_sdks/v2023_05_01/__init__.py | 26 + .../v2023_05_01/_configuration.py | 66 + .../vendored_sdks/v2023_05_01/_patch.py | 20 + .../_source_control_configuration_client.py | 126 + .../vendored_sdks/v2023_05_01/_vendor.py | 30 + .../vendored_sdks/v2023_05_01/_version.py | 9 + .../vendored_sdks/v2023_05_01/aio/__init__.py | 23 + .../v2023_05_01/aio/_configuration.py | 66 + .../vendored_sdks/v2023_05_01/aio/_patch.py | 20 + .../_source_control_configuration_client.py | 126 + .../v2023_05_01/aio/operations/__init__.py | 29 + .../aio/operations/_extensions_operations.py | 946 ++++++ ...flux_config_operation_status_operations.py | 137 + .../_flux_configurations_operations.py | 951 ++++++ .../_operation_status_operations.py | 242 ++ .../v2023_05_01/aio/operations/_operations.py | 135 + .../v2023_05_01/aio/operations/_patch.py | 20 + ...ource_control_configurations_operations.py | 574 ++++ .../v2023_05_01/models/__init__.py | 137 + .../v2023_05_01/models/_models_py3.py | 2796 +++++++++++++++++ .../v2023_05_01/models/_patch.py | 20 + ...urce_control_configuration_client_enums.py | 121 + .../v2023_05_01/operations/__init__.py | 29 + .../operations/_extensions_operations.py | 1151 +++++++ ...flux_config_operation_status_operations.py | 184 ++ .../_flux_configurations_operations.py | 1162 +++++++ .../_operation_status_operations.py | 328 ++ .../v2023_05_01/operations/_operations.py | 157 + .../v2023_05_01/operations/_patch.py | 20 + ...ource_control_configurations_operations.py | 746 +++++ .../v2023_05_01_preview/__init__.py | 26 + .../v2023_05_01_preview/_configuration.py | 60 + .../v2023_05_01_preview/_patch.py | 20 + .../_source_control_configuration_client.py | 97 + .../v2023_05_01_preview/_vendor.py | 30 + .../v2023_05_01_preview/_version.py | 9 + .../v2023_05_01_preview/aio/__init__.py | 23 + .../v2023_05_01_preview/aio/_configuration.py | 60 + .../v2023_05_01_preview/aio/_patch.py | 20 + .../_source_control_configuration_client.py | 97 + .../aio/operations/__init__.py | 23 + .../operations/_extension_types_operations.py | 801 +++++ .../_operation_status_operations.py | 143 + .../aio/operations/_operations.py | 123 + .../aio/operations/_patch.py | 20 + .../v2023_05_01_preview/models/__init__.py | 61 + .../v2023_05_01_preview/models/_models_py3.py | 880 ++++++ .../v2023_05_01_preview/models/_patch.py | 20 + ...urce_control_configuration_client_enums.py | 21 + .../operations/__init__.py | 23 + .../operations/_extension_types_operations.py | 1161 +++++++ .../_operation_status_operations.py | 186 ++ .../operations/_operations.py | 145 + .../v2023_05_01_preview/operations/_patch.py | 20 + src/k8s-extension/setup.py | 2 +- 73 files changed, 15460 insertions(+), 651 deletions(-) create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_configuration.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_source_control_configuration_client.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_vendor.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_version.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_configuration.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_source_control_configuration_client.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_extensions_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_configurations_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_source_control_configurations_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_models_py3.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_source_control_configuration_client_enums.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_extensions_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_config_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_configurations_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_source_control_configurations_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_configuration.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_source_control_configuration_client.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_vendor.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_version.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_configuration.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_source_control_configuration_client.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_extension_types_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_models_py3.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_patch.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_source_control_configuration_client_enums.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/__init__.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_extension_types_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operation_status_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operations.py create mode 100644 src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_patch.py diff --git a/src/k8s-extension/HISTORY.rst b/src/k8s-extension/HISTORY.rst index 8ba9ec4785e..967c23f61ea 100644 --- a/src/k8s-extension/HISTORY.rst +++ b/src/k8s-extension/HISTORY.rst @@ -3,6 +3,12 @@ Release History =============== +1.5.0 +++++++++++++++++++ +* add support for extensionsType api +* Breaking change introduced with API version 2023-05-01 adds validation will begin rejecting calls (PUT and PATCH) that provide a version for the extension and also set autoUpgradeMinorVersion to true +* microsoft.openservicemesh: Update OSM-Arc version check for beta and CI tags + 1.4.5 ++++++++++++++++++ * fix bugs while dropping 'azure-mgmt-relay' diff --git a/src/k8s-extension/azext_k8s_extension/_client_factory.py b/src/k8s-extension/azext_k8s_extension/_client_factory.py index 36e450bf244..add73337a2d 100644 --- a/src/k8s-extension/azext_k8s_extension/_client_factory.py +++ b/src/k8s-extension/azext_k8s_extension/_client_factory.py @@ -17,20 +17,8 @@ def cf_k8s_extension_operation(cli_ctx, *_): return cf_k8s_extension(cli_ctx).extensions -def cf_k8s_cluster_extension_types_operation(cli_ctx, *_): - return cf_k8s_extension(cli_ctx, api_version=consts.EXTENSION_TYPE_API_VERSION).cluster_extension_types - - -def cf_k8s_cluster_extension_type_operation(cli_ctx, *_): - return cf_k8s_extension(cli_ctx, api_version=consts.EXTENSION_TYPE_API_VERSION).cluster_extension_type - - -def cf_k8s_location_extension_types_operation(cli_ctx, *_): - return cf_k8s_extension(cli_ctx, api_version=consts.EXTENSION_TYPE_API_VERSION).location_extension_types - - -def cf_k8s_extension_type_versions_operation(cli_ctx, *_): - return cf_k8s_extension(cli_ctx, api_version=consts.EXTENSION_TYPE_API_VERSION).extension_type_versions +def cf_k8s_extension_types(cli_ctx, *_): + return cf_k8s_extension(cli_ctx, api_version=consts.EXTENSION_TYPE_API_VERSION).extension_types def cf_resource_groups(cli_ctx, subscription_id=None): diff --git a/src/k8s-extension/azext_k8s_extension/_format.py b/src/k8s-extension/azext_k8s_extension/_format.py index d73838f8483..c3781eb7fba 100644 --- a/src/k8s-extension/azext_k8s_extension/_format.py +++ b/src/k8s-extension/azext_k8s_extension/_format.py @@ -34,23 +34,26 @@ def __get_table_row(result): def k8s_extension_types_list_table_format(results): - return [__get_extension_type_table_row(result, False) for result in results] + return [__get_extension_type_table_row(result) for result in results] def k8s_extension_type_show_table_format(result): - return __get_extension_type_table_row(result, True) + return __get_extension_type_table_row(result) -def __get_extension_type_table_row(result, showReleaseTrains): +def __get_extension_type_table_row(result): # Populate the values to be returned if they are not undefined - clusterTypes = ', '.join(result['clusterTypes']) + clusterTypes = '' + if result['properties']['supportedClusterTypes'] is not None: + clusterTypes = ', '.join(result['properties']['supportedClusterTypes']) + name = result['name'] defaultScope, allowMultipleInstances, defaultReleaseNamespace = '', '', '' - if result['supportedScopes']: - defaultScope = result['supportedScopes']['defaultScope'] - if result['supportedScopes']['clusterScopeSettings']: - allowMultipleInstances = result['supportedScopes']['clusterScopeSettings']['allowMultipleInstances'] - defaultReleaseNamespace = result['supportedScopes']['clusterScopeSettings']['defaultReleaseNamespace'] + if result['properties']['supportedScopes']: + defaultScope = result['properties']['supportedScopes']['defaultScope'] + if result['properties']['supportedScopes']['clusterScopeSettings'] is not None: + allowMultipleInstances = result['properties']['supportedScopes']['clusterScopeSettings']['allowMultipleInstances'] + defaultReleaseNamespace = result['properties']['supportedScopes']['clusterScopeSettings']['defaultReleaseNamespace'] retVal = OrderedDict([ ('name', name), @@ -59,9 +62,6 @@ def __get_extension_type_table_row(result, showReleaseTrains): ('allowMultipleInstances', allowMultipleInstances), ('defaultReleaseNamespace', defaultReleaseNamespace) ]) - if showReleaseTrains: - releaseTrains = ', '.join(result['releaseTrains']) - retVal['releaseTrains'] = releaseTrains return retVal @@ -70,9 +70,11 @@ def k8s_extension_type_versions_list_table_format(results): return [__get_extension_type_versions_table_row(result) for result in results] +def k8s_extension_type_version_show_table_format(results): + return __get_extension_type_versions_table_row(results) + + def __get_extension_type_versions_table_row(result): - versions = ", ".join(result['versions']) return OrderedDict([ - ('releaseTrain', result['releaseTrain']), - ('versions', versions) + ('versions', result['properties']['version']) ]) diff --git a/src/k8s-extension/azext_k8s_extension/_help.py b/src/k8s-extension/azext_k8s_extension/_help.py index 56987dce90c..1805d6b4436 100644 --- a/src/k8s-extension/azext_k8s_extension/_help.py +++ b/src/k8s-extension/azext_k8s_extension/_help.py @@ -83,41 +83,79 @@ short-summary: Commands to discover Kubernetes Extension Types. """ -helps[f'{consts.EXTENSION_NAME} extension-types list'] = f""" +helps[f'{consts.EXTENSION_NAME} extension-types show-by-cluster'] = f""" type: command - short-summary: List Kubernetes Extension Types. + short-summary: Show properties for a Cluster Extension Type for an existing cluster. The properties used for filtering include type of cluster (managed, connected, etc), kubernetes version, location of the cluster. examples: - - name: List Kubernetes Extension Types + - name: Show properties for a Cluster Extension Type for an existing cluster text: |- - az {consts.EXTENSION_NAME} extension-types list --resource-group my-resource-group \ + az {consts.EXTENSION_NAME} extension-types show-by-cluster --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --extension-type microsoft.openservicemesh +""" + +helps[f'{consts.EXTENSION_NAME} extension-types show-by-location'] = f""" + type: command + short-summary: Show properties for a Cluster Extension Type in a region. + examples: + - name: Show properties for a Cluster Extension Type in a region + text: |- + az {consts.EXTENSION_NAME} extension-types show-by-location --location eastus --extension-type microsoft.openservicemesh +""" + +helps[f'{consts.EXTENSION_NAME} extension-types show-version-by-cluster'] = f""" + type: command + short-summary: Show properties associated with a Cluster Extension Type version for an existing cluster. The properties used for filtering include type of cluster (managed, connected, etc), kubernetes version, location of the cluster. + examples: + - name: Show properties associated with a Cluster Extension Type version for an existing cluster + text: |- + az {consts.EXTENSION_NAME} extension-types show-version-by-cluster --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --extension-type microsoft.openservicemesh --version 1.0.0 +""" + +helps[f'{consts.EXTENSION_NAME} extension-types show-version-by-location'] = f""" + type: command + short-summary: Show properties associated with a Cluster Extension Type version in a region. + examples: + - name: Show properties associated with a Cluster Extension Type version in a region. + text: |- + az {consts.EXTENSION_NAME} extension-types show-version-by-location --location eastus --extension-type microsoft.openservicemesh \ +--version 1.0.0 +""" + +helps[f'{consts.EXTENSION_NAME} extension-types list-by-cluster'] = f""" + type: command + short-summary: List available Cluster Extension Types for an existing cluster. The properties used for filtering include type of cluster (managed, connected, etc), kubernetes version, location of the cluster. + examples: + - name: List available Cluster Extension Types for an existing cluster + text: |- + az {consts.EXTENSION_NAME} extension-types list-by-cluster --resource-group my-resource-group \ --cluster-name mycluster --cluster-type connectedClusters """ helps[f'{consts.EXTENSION_NAME} extension-types list-by-location'] = f""" type: command - short-summary: List available Kubernetes Extension Types in a specified region. + short-summary: List available Cluster Extension Types in a region. examples: - - name: List Kubernetes Extension Types by location + - name: List available Cluster Extension Types in a region text: |- - az {consts.EXTENSION_NAME} extension-types list-by-location --location eastus2euap + az {consts.EXTENSION_NAME} extension-types list-by-location --location eastus """ -helps[f'{consts.EXTENSION_NAME} extension-types show'] = f""" +helps[f'{consts.EXTENSION_NAME} extension-types list-versions-by-cluster'] = f""" type: command - short-summary: Show properties for a Kubernetes Extension Type. + short-summary: List available versions for a Cluster Extension Type for a given cluster. The properties used for filtering include type of cluster (managed, connected, etc), kubernetes version, location of the cluster. examples: - - name: Show Kubernetes Extension Type + - name: List available versions for a Cluster Extension Type for a given cluster text: |- - az {consts.EXTENSION_NAME} extension-types show --resource-group my-resource-group \ ---cluster-name mycluster --cluster-type connectedClusters --extension-type cassandradatacenteroperator + az {consts.EXTENSION_NAME} extension-types list-versions-by-cluster --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --extension-type microsoft.flux """ -helps[f'{consts.EXTENSION_NAME} extension-types list-versions'] = f""" +helps[f'{consts.EXTENSION_NAME} extension-types list-versions-by-location'] = f""" type: command - short-summary: List available versions for a Kubernetes Extension Type. + short-summary: List available versions for a Cluster Extension Type versions in a region. examples: - - name: List versions for an Extension Type + - name: List available versions for a Cluster Extension Type versions in a region text: |- - az {consts.EXTENSION_NAME} extension-types list-versions --location eastus2euap \ ---extension-type cassandradatacenteroperator + az {consts.EXTENSION_NAME} extension-types list-versions-by-location --location eastus --extension-type microsoft.flux """ diff --git a/src/k8s-extension/azext_k8s_extension/_params.py b/src/k8s-extension/azext_k8s_extension/_params.py index 5708813622e..e99ffa12c86 100644 --- a/src/k8s-extension/azext_k8s_extension/_params.py +++ b/src/k8s-extension/azext_k8s_extension/_params.py @@ -99,7 +99,7 @@ def load_arguments(self, _): c.argument('force', help='Specify whether to force delete the extension from the cluster.') - with self.argument_context(f"{consts.EXTENSION_NAME} extension-types list") as c: + with self.argument_context(f"{consts.EXTENSION_NAME} extension-types") as c: c.argument('cluster_name', options_list=['--cluster-name', '-c'], help='Name of the Kubernetes cluster') @@ -107,24 +107,27 @@ def load_arguments(self, _): arg_type=get_enum_type(['connectedClusters', 'managedClusters', 'appliances']), options_list=['--cluster-type', '-t'], help='Specify Arc clusters or AKS managed clusters or Arc appliances.') - - with self.argument_context(f"{consts.EXTENSION_NAME} extension-types list-by-location") as c: - c.argument('location', - validator=get_default_location_from_resource_group) - - with self.argument_context(f"{consts.EXTENSION_NAME} extension-types show") as c: - c.argument('extension_type', - help='Name of the extension type.') - c.argument('cluster_name', - options_list=['--cluster-name', '-c'], - help='Name of the Kubernetes cluster') - c.argument('cluster_type', - arg_type=get_enum_type(['connectedClusters', 'managedClusters', 'appliances']), - options_list=['--cluster-type', '-t'], - help='Specify Arc clusters or AKS managed clusters or Arc appliances.') - - with self.argument_context(f"{consts.EXTENSION_NAME} extension-types list-versions") as c: c.argument('extension_type', help='Name of the extension type.') c.argument('location', - validator=get_default_location_from_resource_group) + validator=get_default_location_from_resource_group, + help='Name of the location. Values from: `az account list-locations`') + c.argument('version', + help='Version for the extension type.') + c.argument('plan_name', + arg_group="Marketplace", + options_list=['--plan-name'], + help='The plan name is referring to the Marketplace Plan ID of the extension.') + c.argument('plan_product', + arg_group="Marketplace", + options_list=['--plan-product'], + help='The plan product is referring to the Marketplace Product ID of the extension.') + c.argument('plan_publisher', + arg_group="Marketplace", + options_list=['--plan-publisher'], + help='The plan publisher is referring to the Marketplace Publisher ID of the extension') + c.argument('major_version', + help='Filter results by only the major version of an extension type. For example if 1 is specified, all versions with major version 1 (1.1, 1.1.2) will be shown. The default value is None') + c.argument('show_latest', + arg_type=get_three_state_flag(), + help='Filter results by only the latest version. For example, if this flag is used the latest version of the extensionType will be shown.') diff --git a/src/k8s-extension/azext_k8s_extension/commands.py b/src/k8s-extension/azext_k8s_extension/commands.py index 981635e9883..9875c6b1231 100644 --- a/src/k8s-extension/azext_k8s_extension/commands.py +++ b/src/k8s-extension/azext_k8s_extension/commands.py @@ -5,8 +5,8 @@ # pylint: disable=line-too-long from azure.cli.core.commands import CliCommandType, client_factory -from ._client_factory import (cf_k8s_extension, cf_k8s_extension_operation, cf_k8s_cluster_extension_types_operation, cf_k8s_cluster_extension_type_operation, cf_k8s_location_extension_types_operation, cf_k8s_extension_type_versions_operation) -from ._format import k8s_extension_list_table_format, k8s_extension_show_table_format, k8s_extension_types_list_table_format, k8s_extension_type_versions_list_table_format, k8s_extension_type_show_table_format +from ._client_factory import (cf_k8s_extension, cf_k8s_extension_operation, cf_k8s_extension_types) +from ._format import k8s_extension_list_table_format, k8s_extension_show_table_format, k8s_extension_types_list_table_format, k8s_extension_type_versions_list_table_format, k8s_extension_type_show_table_format, k8s_extension_type_version_show_table_format from . import consts @@ -27,28 +27,23 @@ def load_command_table(self, _): # Subgroup - k8s-extension extension-types k8s_cluster_extension_type_sdk = CliCommandType( operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.vendored_sdks.operations#ClusterExtensionTypeOperations.{}', - client_factory=cf_k8s_cluster_extension_type_operation) - with self.command_group(consts.EXTENSION_NAME + " extension-types", k8s_cluster_extension_type_sdk, client_factory=cf_k8s_cluster_extension_type_operation, is_preview=True) \ + client_factory=cf_k8s_extension_types) + with self.command_group(consts.EXTENSION_NAME + " extension-types", k8s_cluster_extension_type_sdk, client_factory=cf_k8s_extension_types, is_preview=True) \ as g: - g.custom_show_command('show', 'show_k8s_cluster_extension_type', table_transformer=k8s_extension_type_show_table_format) + g.custom_command('list-by-location', 'list_extension_types_by_location', table_transformer=k8s_extension_types_list_table_format) + g.custom_command('show-by-location', 'show_extension_type_by_location', table_transformer=k8s_extension_type_show_table_format) - k8s_cluster_extension_types_sdk = CliCommandType( - operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.vendored_sdks.operations.#ClusterExtensionTypesOperations.{}', - client_factory=cf_k8s_cluster_extension_types_operation) - with self.command_group(consts.EXTENSION_NAME + " extension-types", k8s_cluster_extension_types_sdk, client_factory=cf_k8s_cluster_extension_types_operation, is_preview=True) \ - as g: - g.custom_command('list', 'list_k8s_cluster_extension_types', table_transformer=k8s_extension_types_list_table_format) + g.custom_command('list-versions-by-location', 'list_extension_type_versions_by_location', table_transformer=k8s_extension_type_versions_list_table_format) + g.custom_command('show-version-by-location', 'show_extension_type_version_by_location', table_transformer=k8s_extension_type_version_show_table_format) - k8s_location_extension_types_sdk = CliCommandType( - operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.vendored_sdks.operations.#LocationExtensionTypesOperations.{}', - client_factory=cf_k8s_location_extension_types_operation) - with self.command_group(consts.EXTENSION_NAME + " extension-types", k8s_location_extension_types_sdk, client_factory=cf_k8s_location_extension_types_operation, is_preview=True) \ - as g: - g.custom_command('list-by-location', 'list_k8s_location_extension_types', table_transformer=k8s_extension_types_list_table_format) + g.custom_command('list-by-cluster', 'list_extension_types_by_cluster', table_transformer=k8s_extension_types_list_table_format) + g.custom_command('show-by-cluster', 'show_extension_type_by_cluster', table_transformer=k8s_extension_type_show_table_format) - k8s_extension_type_versions_sdk = CliCommandType( - operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.vendored_sdks.operations.#ExtensionTypeVersionsOperations.{}', - client_factory=cf_k8s_extension_type_versions_operation) - with self.command_group(consts.EXTENSION_NAME + " extension-types", k8s_extension_type_versions_sdk, client_factory=cf_k8s_extension_type_versions_operation, is_preview=True) \ - as g: - g.custom_command('list-versions', 'list_k8s_extension_type_versions', table_transformer=k8s_extension_type_versions_list_table_format) + g.custom_command('list-versions-by-cluster', 'list_extension_type_versions_by_cluster', table_transformer=k8s_extension_type_versions_list_table_format) + g.custom_command('show-version-by-cluster', 'show_extension_type_version_by_cluster', table_transformer=k8s_extension_type_version_show_table_format) + + g.custom_show_command('show', 'show_extension_type_by_location', deprecate_info=g.deprecate(redirect='az k8s-extension extension-types show-by-cluster', hide=True), table_transformer=k8s_extension_type_show_table_format) + + g.custom_command('list', 'list_extension_types_by_cluster', deprecate_info=g.deprecate(redirect='az k8s-extension extension-types list-by-cluster', hide=True), table_transformer=k8s_extension_types_list_table_format) + + g.custom_command('list-versions', 'list_extension_type_versions_by_cluster', deprecate_info=g.deprecate(redirect='az k8s-extension extension-types list-versions-by-cluster', hide=True), table_transformer=k8s_extension_type_versions_list_table_format) diff --git a/src/k8s-extension/azext_k8s_extension/consts.py b/src/k8s-extension/azext_k8s_extension/consts.py index ed10734d68f..0de1ce60576 100644 --- a/src/k8s-extension/azext_k8s_extension/consts.py +++ b/src/k8s-extension/azext_k8s_extension/consts.py @@ -25,4 +25,4 @@ APPLIANCE_API_VERSION = "2021-10-31-preview" HYBRIDCONTAINERSERVICE_API_VERSION = "2022-05-01-preview" -EXTENSION_TYPE_API_VERSION = "2022-01-15-preview" +EXTENSION_TYPE_API_VERSION = "2023-05-01-preview" diff --git a/src/k8s-extension/azext_k8s_extension/custom.py b/src/k8s-extension/azext_k8s_extension/custom.py index 323ef341fd4..c88461bb48e 100644 --- a/src/k8s-extension/azext_k8s_extension/custom.py +++ b/src/k8s-extension/azext_k8s_extension/custom.py @@ -370,52 +370,163 @@ def delete_k8s_extension( ) -def list_k8s_extension_type_versions(cmd, client, location, extension_type): - """ List available extension type versions - """ - versions_list = client.list(location, extension_type) +# list by location +def list_extension_types_by_location( + client, + location, + plan_publisher=None, + plan_product=None, + plan_name=None, + release_train=None, + cluster_type=None): + + """ List available Cluster Extension Types in a region.""" + + return client.location_list( + location, + plan_publisher, + plan_product, + plan_name, + release_train, + cluster_type) + + +# get by location +def show_extension_type_by_location(client, location, extension_type): + + """Get properties for a Cluster Extension Type in a region.""" + return client.location_get( + location, + extension_type + ) + + +# list version by location +def list_extension_type_versions_by_location( + client, + location, + extension_type, + release_train=None, + cluster_type=None, + major_version=None, + show_latest=False): + + """ List available versions for a Cluster Extension Type versions in a region. """ + + versions_list = client.list_versions( + location, + extension_type, + release_train, + cluster_type, + major_version, + show_latest) return versions_list -def list_k8s_cluster_extension_types(client, resource_group_name, cluster_name, cluster_type): - """ List available extension types - """ - cluster_rp, parent_api_version = get_cluster_rp_api_version(cluster_type) - return client.list(resource_group_name, cluster_rp, cluster_type, cluster_name) +# get version by location +def show_extension_type_version_by_location( + client, + location, + extension_type, + version): + """ Get properties associated with a Cluster Extension Type version in a region.""" + version = client.get_version( + location, + extension_type, + version) + return version -def list_k8s_location_extension_types(client, location): - """ List available extension types based on location - """ - return client.list(location) +# list by cluster +def list_extension_types_by_cluster( + client, + resource_group_name, + cluster_name, + cluster_type, + plan_publisher=None, + plan_name=None, + plan_product=None, + release_train=None): -def show_k8s_cluster_extension_type(client, resource_group_name, cluster_type, cluster_name, extension_type): - """Get an existing Extension Type. - """ - # Determine ClusterRP - cluster_rp, parent_api_version = get_cluster_rp_api_version(cluster_type) + """ List available Cluster Extension Types for an existing cluster.""" + cluster_rp, _ = get_cluster_rp_api_version(cluster_type) - try: - extension_type = client.get(resource_group_name, - cluster_rp, cluster_type, cluster_name, extension_type) - return extension_type - except HttpResponseError as ex: - # Customize the error message for resources not found - if ex.response.status_code == 404: - # If Cluster not found - if ex.message.__contains__("(ResourceNotFound)"): - message = "{0} Verify that the extension type is correct and the resource exists.".format( - ex.message) - # If Configuration not found - elif ex.message.__contains__("Operation returned an invalid status code 'Not Found'"): - message = "(ExtensionNotFound) The Resource {0}/{1}/{2}/Microsoft.KubernetesConfiguration/" \ - "extensions/{3} could not be found!".format( - cluster_rp, cluster_type, cluster_name, extension_type) - else: - message = ex.message - raise ResourceNotFoundError(message) from ex - raise ex + return client.list( + resource_group_name, + cluster_rp, + cluster_type, + cluster_name, + plan_publisher, + plan_product, + plan_name, + release_train) + + +# get by cluster +def show_extension_type_by_cluster( + client, + resource_group_name, + cluster_name, + cluster_type, + extension_type): + + """ Get properties for a Cluster Extension Type for an existing cluster""" + cluster_rp, _ = get_cluster_rp_api_version(cluster_type) + + return client.get( + resource_group_name, + cluster_rp, + cluster_type, + cluster_name, + extension_type) + + +# list version by cluster +def list_extension_type_versions_by_cluster( + client, + resource_group_name, + cluster_type, + cluster_name, + extension_type, + release_train=None, + major_version=None, + show_latest=False): + + """ List available versions for a Cluster Extension Type for a given cluster.""" + cluster_rp, _ = get_cluster_rp_api_version(cluster_type) + + return client.cluster_list_versions( + resource_group_name, + cluster_rp, + cluster_type, + cluster_name, + extension_type, + release_train, + major_version, + show_latest) + + +# get version by cluster +def show_extension_type_version_by_cluster( + client, + resource_group_name, + cluster_type, + cluster_name, + extension_type, + version): + + """ Get properties associated with a Cluster Extension Type version for an existing cluster""" + + cluster_rp, _ = get_cluster_rp_api_version(cluster_type) + + return client.cluster_get_version( + resource_group_name, + cluster_rp, + cluster_type, + cluster_name, + extension_type, + version) def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp): diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py index 2853f2a42d5..3ff0d6d16a1 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py @@ -106,7 +106,10 @@ def _validate_tested_distro(cmd, cluster_resource_group_name, cluster_name, exte ext_str = str(extension_version) # Don't parse version for test and CI tags - if "pr" not in ext_str and "release" not in ext_str and version.parse(ext_str) <= version.parse("0.8.3"): + if "pr" in ext_str or "release" in ext_str or "beta" in ext_str: + return + + if version.parse(ext_str) <= version.parse("0.8.3"): logger.warning(field_unavailable_error) return diff --git a/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension.yaml b/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension.yaml index 2b1b5bf6375..05b07fb1a46 100644 --- a/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension.yaml +++ b/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension.yaml @@ -12,11 +12,11 @@ interactions: - keep-alive ParameterSetName: - -g -n -c --cluster-type --extension-type --release-train --version --configuration-settings - --no-wait + --no-wait --auto-upgrade User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.10.8 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-resource/22.0.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2022-09-01 response: body: string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration","namespace":"Microsoft.KubernetesConfiguration","authorizations":[{"applicationId":"c699bf69-fb1d-4eaf-999b-99e6b2ae4d85","roleDefinitionId":"90155430-a360-410f-af5d-89dc284d85c6"},{"applicationId":"03db181c-e9d3-4868-9097-f0b728327182","roleDefinitionId":"DE2ADB97-42D8-49C8-8FCF-DBB53EF936AC"},{"applicationId":"a0f92522-89de-4c5e-9a75-0044ccf66efd","roleDefinitionId":"b3429810-7d5c-420e-8605-cf280f3099f2"},{"applicationId":"bd9b7cd5-dac1-495f-b013-ac871e98fa5f","roleDefinitionId":"0d44c8f0-08b9-44d4-9f59-e51c83f95200"},{"applicationId":"585fc3c3-9a59-4720-8319-53cce041a605","roleDefinitionId":"4a9ce2ee-6de2-43ba-a7bd-8f316de763a7"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East @@ -26,14 +26,16 @@ interactions: East","Canada East","Canada Central","Norway East","Germany West Central","Sweden Central","Switzerland North","Australia Southeast","Central India","South India","Japan West","Uk West","France South","Korea South","South Africa North","Brazil - South","Uae North","East US 2 EUAP","Central US EUAP"],"apiVersions":["2022-11-01","2022-07-01","2022-03-01","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2022-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East + South","Uae North","Norway West","Germany North","Jio India West","East US + 2 EUAP","Central US EUAP"],"apiVersions":["2023-05-01","2022-11-01","2022-07-01","2022-03-01","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2022-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East US","West Europe","West Central US","West US 2","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central US","North Central US","West US","Korea Central","East Asia","Japan East","Canada East","Canada Central","Norway East","Germany West Central","Sweden Central","Switzerland North","Australia Southeast","Central India","South India","Japan West","Uk West","France South","Korea South","South Africa North","Brazil - South","Uae North","East US 2 EUAP","Central US EUAP"],"apiVersions":["2022-11-01","2022-07-01","2022-04-02-preview","2022-03-01","2021-09-01","2021-05-01-preview","2020-07-01-preview"],"defaultApiVersion":"2022-07-01","capabilities":"SystemAssignedResourceIdentity, + South","Uae North","Norway West","Germany North","Jio India West","East US + 2 EUAP","Central US EUAP"],"apiVersions":["2023-05-01","2022-11-01","2022-07-01","2022-03-01","2020-07-01-preview"],"defaultApiVersion":"2022-07-01","capabilities":"SystemAssignedResourceIdentity, SupportsExtension"},{"resourceType":"fluxConfigurations","locations":["East US","West Europe","West Central US","West US 2","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France @@ -41,7 +43,32 @@ interactions: East","Canada East","Canada Central","Norway East","Germany West Central","Sweden Central","Switzerland North","Australia Southeast","Central India","South India","Japan West","Uk West","Korea South","France South","South Africa North","Brazil - South","Uae North"],"apiVersions":["2022-11-01","2022-07-01","2022-03-01","2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-07-01","capabilities":"SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2022-11-01","2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"privateLinkScopes","locations":["East + South","Uae North","Norway West","Germany North","Jio India West","East US + 2 EUAP","Central US EUAP"],"apiVersions":["2023-05-01","2022-11-01","2022-07-01","2022-03-01","2022-01-01-preview","2021-11-01-preview","2021-06-01-preview"],"defaultApiVersion":"2022-07-01","capabilities":"SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2023-05-01-preview","2023-05-01","2022-11-01","2022-03-01","2022-01-01-preview","2021-12-01-preview","2021-11-01-preview","2021-09-01","2021-06-01-preview","2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"},{"resourceType":"extensionTypes","locations":["West + US 2","East US","West Europe","West Central US","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","Canada Central","Canada East","Norway East","Central India","South + India","Australia Southeast","Germany West Central","Switzerland North","Sweden + Central","Japan West","Uk West","Korea South","France South","South Africa + North","Brazil South","Uae North","Norway West","Germany North","Jio India + West","East US 2 EUAP"],"apiVersions":["2023-05-01-preview","2022-01-15-preview"],"capabilities":"SupportsExtension"},{"resourceType":"locations/extensionTypes","locations":["West + US 2","East US","West Europe","West Central US","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","Canada Central","Canada East","Central India","South India","Norway + East","Australia Southeast","Germany West Central","Switzerland North","Sweden + Central","Japan West","Uk West","Korea South","France South","South Africa + North","Brazil South","Uae North","Norway West","Germany North","Jio India + West","East US 2 EUAP"],"apiVersions":["2023-05-01-preview","2022-01-15-preview"],"capabilities":"None"},{"resourceType":"locations/extensionTypes/versions","locations":["West + US 2","East US","West Europe","West Central US","West US 3","South Central + US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France + Central","Central US","North Central US","West US","Korea Central","East Asia","Japan + East","Canada Central","Canada East","Central India","Norway East","Australia + Southeast","Germany West Central","Switzerland North","Sweden Central","Japan + West","Uk West","Korea South","France South","South Africa North","South India","Brazil + South","Uae North","Norway West","Germany North","Jio India West","East US + 2 EUAP"],"apiVersions":["2023-05-01-preview","2022-01-15-preview"],"capabilities":"None"},{"resourceType":"privateLinkScopes","locations":["East US","West Europe","West Central US","West US 2","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central US","North Central US","West US","Korea Central","East Asia","Japan @@ -63,44 +90,24 @@ interactions: East","Canada East","Canada Central","Norway East","Germany West Central","Sweden Central","Switzerland North","Australia Southeast","Central India","South India","Japan West","Uk West","South Africa North","Korea South","France South","Brazil - South","Uae North","East US 2 EUAP","Central US EUAP"],"apiVersions":["2022-04-02-preview"],"capabilities":"None"},{"resourceType":"extensionTypes","locations":["East - US 2 EUAP","West US 2","East US","West Europe","West Central US","West US - 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia - East","France Central","Central US","North Central US","West US","Korea Central","East - Asia","Japan East","Canada Central","Canada East","Norway East","Central India","South - India","Australia Southeast","Germany West Central","Switzerland North","Sweden - Central","Japan West","Uk West","Korea South","France South","South Africa - North","Brazil South","Uae North"],"apiVersions":["2022-01-15-preview"],"capabilities":"SupportsExtension"},{"resourceType":"locations","locations":["East + South","Uae North","East US 2 EUAP","Central US EUAP"],"apiVersions":["2022-04-02-preview"],"capabilities":"None"},{"resourceType":"locations","locations":["East US 2 EUAP","West US 2","East US","West Europe","West Central US","West US 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia East","France Central","Central US","North Central US","West US","Korea Central","East Asia","Japan East","Canada Central","Canada East","Central India","South India","Norway East","Australia Southeast","Germany West Central","Switzerland North","Sweden Central","Japan West","Uk West","Korea South","France South","South Africa - North","Brazil South","Uae North"],"apiVersions":["2022-01-15-preview"],"capabilities":"None"},{"resourceType":"locations/extensionTypes","locations":["East - US 2 EUAP","West US 2","East US","West Europe","West Central US","West US - 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia - East","France Central","Central US","North Central US","West US","Korea Central","East - Asia","Japan East","Canada Central","Canada East","Central India","South India","Norway - East","Australia Southeast","Germany West Central","Switzerland North","Sweden - Central","Japan West","Uk West","Korea South","France South","South Africa - North","Brazil South","Uae North"],"apiVersions":["2022-01-15-preview"],"capabilities":"None"},{"resourceType":"locations/extensionTypes/versions","locations":["East - US 2 EUAP","West US 2","East US","West Europe","West Central US","West US - 3","South Central US","East US 2","North Europe","UK South","Southeast Asia","Australia - East","France Central","Central US","North Central US","West US","Korea Central","East - Asia","Japan East","Canada Central","Canada East","Central India","Norway - East","Australia Southeast","Germany West Central","Switzerland North","Sweden - Central","Japan West","Uk West","Korea South","France South","South Africa - North","South India","Brazil South","Uae North"],"apiVersions":["2022-01-15-preview"],"capabilities":"None"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + North","Brazil South","Uae North","Norway West","Germany North","Jio India + West"],"apiVersions":["2023-05-01-preview","2022-01-15-preview"],"capabilities":"None"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' headers: cache-control: - no-cache content-length: - - '8181' + - '8647' content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:16 GMT + - Wed, 19 Jul 2023 18:31:22 GMT expires: - '-1' pragma: @@ -115,10 +122,10 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"extensionType": "microsoft.dapr", "releaseTrain": "stable", - "version": "1.6.0", "scope": {"cluster": {"releaseNamespace": "dapr-system"}}, - "configurationSettings": {"skipExistingDaprCheck": "true"}, "configurationProtectedSettings": - {}}}' + body: '{"properties": {"extensionType": "microsoft.dapr", "autoUpgradeMinorVersion": + false, "releaseTrain": "stable", "version": "1.6.0", "scope": {"cluster": {"releaseNamespace": + "dapr-system"}}, "configurationSettings": {"skipExistingDaprCheck": "true"}, + "configurationProtectedSettings": {}}}' headers: Accept: - application/json @@ -129,37 +136,37 @@ interactions: Connection: - keep-alive Content-Length: - - '254' + - '288' Content-Type: - application/json ParameterSetName: - -g -n -c --cluster-type --extension-type --release-train --version --configuration-settings - --no-wait + --no-wait --auto-upgrade User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2022-11-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2023-05-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-01-12T22:43:18.1754991+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-01-12T22:43:18.1754991+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","currentVersion":null,"scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-07-19T18:31:24.4169171+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-07-19T18:31:24.4169171+00:00"}}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/ConnectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr/operations/29f0ffb2-3281-47d6-8218-1d42bcfddbc9?api-Version=2022-11-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/ConnectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr/operations/dbef82c3-3ef9-493e-8253-e5519262973a?api-Version=2023-05-01 cache-control: - no-cache content-length: - - '849' + - '871' content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:17 GMT + - Wed, 19 Jul 2023 18:31:24 GMT expires: - '-1' location: - - https://eastus2euap.rp.kubernetesconfiguration.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/ConnectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr + - https://eastus.rp.kubernetesconfiguration.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/ConnectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr pragma: - no-cache strict-transport-security: @@ -185,24 +192,24 @@ interactions: ParameterSetName: - -c -g --cluster-type User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2022-11-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2023-05-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-01-12T22:43:18.1754991+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-01-12T22:43:18.1754991+00:00"}}],"nextLink":null}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","currentVersion":null,"scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-07-19T18:31:24.4169171+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-07-19T18:31:24.4169171+00:00"}}],"nextLink":null}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' cache-control: - no-cache content-length: - - '877' + - '899' content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:17 GMT + - Wed, 19 Jul 2023 18:31:25 GMT expires: - '-1' pragma: @@ -232,24 +239,24 @@ interactions: ParameterSetName: - -c -g -n --cluster-type User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2022-11-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2023-05-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-01-12T22:43:18.1754991+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-01-12T22:43:18.1754991+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","currentVersion":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-07-19T18:31:24.4169171+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-07-19T18:31:24.4169171+00:00"}}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' cache-control: - no-cache content-length: - - '849' + - '874' content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:18 GMT + - Wed, 19 Jul 2023 18:31:25 GMT expires: - '-1' pragma: @@ -279,24 +286,24 @@ interactions: ParameterSetName: - -g -c -n --cluster-type --force -y User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2022-11-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2023-05-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-01-12T22:43:18.1754991+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-01-12T22:43:18.1754991+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.dapr","autoUpgradeMinorVersion":false,"releaseTrain":"stable","version":"1.6.0","currentVersion":"1.6.0","scope":{"cluster":{"releaseNamespace":"dapr-system"}},"provisioningState":"Creating","configurationSettings":{"skipExistingDaprCheck":"true"},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null,"isSystemExtension":false},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2023-07-19T18:31:24.4169171+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2023-07-19T18:31:24.4169171+00:00"}}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' cache-control: - no-cache content-length: - - '849' + - '874' content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:19 GMT + - Wed, 19 Jul 2023 18:31:26 GMT expires: - '-1' pragma: @@ -328,16 +335,16 @@ interactions: ParameterSetName: - -g -c -n --cluster-type --force -y User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2022-11-01&forceDelete=true + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions/dapr?api-version=2023-05-01&forceDelete=true response: body: - string: '{"content":{"headers":[]},"statusCode":200,"headers":[],"version":"1.1","reasonPhrase":"OK","trailingHeaders":[],"requestMessage":null,"isSuccessStatusCode":true}' + string: '{"version":"1.1","content":{"headers":[]},"statusCode":200,"reasonPhrase":"OK","headers":[],"trailingHeaders":[],"requestMessage":null,"isSuccessStatusCode":true}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' cache-control: - no-cache content-length: @@ -345,7 +352,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:20 GMT + - Wed, 19 Jul 2023 18:31:26 GMT expires: - '-1' pragma: @@ -377,16 +384,16 @@ interactions: ParameterSetName: - -c -g --cluster-type User-Agent: - - AZURECLI/2.43.0 azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 Python/3.10.8 + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2022-11-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2023-05-01 response: body: string: '{"value":[],"nextLink":null}' headers: api-supported-versions: - - '2022-11-01' + - '2023-05-01' cache-control: - no-cache content-length: @@ -394,7 +401,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 12 Jan 2023 22:43:21 GMT + - Wed, 19 Jul 2023 18:31:28 GMT expires: - '-1' pragma: diff --git a/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension_types.yaml b/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension_types.yaml index a1d59fe92da..0b45c41a482 100644 --- a/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension_types.yaml +++ b/src/k8s-extension/azext_k8s_extension/tests/latest/recordings/test_k8s_extension_types.yaml @@ -7,42 +7,45 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - k8s-extension extension-types show + - k8s-extension extension-types show-by-cluster Connection: - keep-alive ParameterSetName: - -g -c --cluster-type --extension-type User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperator?api-version=2022-01-15-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples?api-version=2023-05-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperator","name":"cassandradatacentersoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":["stable"],"clusterTypes":["managedclusters","appliances"]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples","name":"microsoft.contoso.samples","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.samples","description":"Extension + for Testing only","isSystemExtension":false,"publisher":"Microsoft Contoso + Samples","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso Samples"}}}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '505' + - '788' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:48 GMT + - Mon, 18 Sep 2023 22:56:33 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: D0663808D03D4A218A2DBC716F5DE559 Ref B: CO6AA3150219027 Ref C: 2023-09-18T22:56:33Z' status: code: 200 message: OK @@ -54,45 +57,45 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - k8s-extension extension-types list + - k8s-extension extension-types show-by-location Connection: - keep-alive ParameterSetName: - - -g -c --cluster-type + - -l --extension-type User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes?api-version=2022-01-15-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples?api-version=2023-05-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/azuremonitor-containers","name":"azuremonitor-containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.policy","name":"microsoft.policy","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.openservicemesh","name":"microsoft.openservicemesh","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc-osm-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperator","name":"cassandradatacentersoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["managedclusters","appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.apimanagement.gateway","name":"microsoft.apimanagement.gateway","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"gateway"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.web.appservice","name":"microsoft.web.appservice","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"appservice"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/ansibletoweroperator","name":"ansibletoweroperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"awx-operator"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azuredefender.kubernetes","name":"microsoft.azuredefender.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.eventgrid","name":"microsoft.eventgrid","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"eventgrid-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azureml.kubernetes","name":"microsoft.azureml.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-ml"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"dapr-system"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurenw.mobilenetwork","name":"microsoft.azurenw.mobilenetwork","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurenw-mn"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.arcdataservices","name":"microsoft.arcdataservices","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc"}},"releaseTrains":[],"clusterTypes":["connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.scvmm","name":"microsoft.scvmm","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-vmmoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.avs","name":"microsoft.avs","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-avsoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.vmware","name":"microsoft.vmware","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-vmwareoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azstackhci.operator","name":"microsoft.azstackhci.operator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azstackhci-operator"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurenw.networkfunction","name":"microsoft.azurenw.networkfunction","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-networkfunction"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azuremonitor.containers","name":"microsoft.azuremonitor.containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["ConnectedCluster","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.unitycloud.konductor","name":"microsoft.unitycloud.konductor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"konductor"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.policyinsights","name":"microsoft.policyinsights","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.cnab","name":"microsoft.cnab","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"cnab-operator"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azure.hybridnetwork","name":"microsoft.azure.hybridnetwork","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurehybridnetwork"}},"releaseTrains":[],"clusterTypes":["appliances","provisionedclusters","connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurebackup.backupagent","name":"microsoft.azurebackup.backupagent","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurebackup"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.aksedgeoperator","name":"microsoft.aksedgeoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"aksedge-operator-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.flux","name":"microsoft.flux","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"flux-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","managedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurebackup.dataprotectionplugin","name":"microsoft.azurebackup.dataprotectionplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.containerregistry.connectedregistry","name":"microsoft.containerregistry.connectedregistry","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"connected-registry"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.dapr","name":"microsoft.dapr","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"dapr-system"}},"releaseTrains":[],"clusterTypes":["connectedCluster","managedClusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.hybridaksoperator","name":"microsoft.hybridaksoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"hybridaks-operator-system"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurekeyvaultsecretsprovider","name":"microsoft.azurekeyvaultsecretsprovider","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.testbonsaiextension","name":"microsoft.testbonsaiextension","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperator1","name":"cassandradatacentersoperator1","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["managedclusters","appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurevote.previewstandard","name":"microsoft.azurevote.previewstandard","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"vote"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.servicelinker.connection","name":"microsoft.servicelinker.connection","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"default"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/deislabs.akri","name":"deislabs.akri","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"akri"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.arcextensionusage","name":"microsoft.arcextensionusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc-osm-system"}},"releaseTrains":[],"clusterTypes":["managedclusters","connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azure.mobilenetwork.packetcoremonitor","name":"microsoft.azure.mobilenetwork.packetcoremonitor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"packet-core-monitor"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.extensionsusage","name":"microsoft.extensionsusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-extensions-usage-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.connectedopenstack","name":"microsoft.connectedopenstack","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"connectedopenstack"}},"releaseTrains":[],"clusterTypes":["Appliances","connectedCluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp","name":"microsoft.networkcloud.userrp","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.aziot.edge","name":"microsoft.aziot.edge","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"aziotedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.appliance.management.operator","name":"microsoft.appliance.management.operator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kva-management"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp.dev","name":"microsoft.networkcloud.userrp.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.dev","name":"microsoft.networkcloud.clustermanager.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.dev","name":"microsoft.networkcloud.platformcluster.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.managednetworkfabric","name":"microsoft.managednetworkfabric","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"managednetworkfabric"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/ - microsoft.azurebackup.mockplugin","name":" microsoft.azurebackup.mockplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":" - namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurebackup.mockplugin","name":"microsoft.azurebackup.mockplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":" - namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/connectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp.staging","name":"microsoft.networkcloud.userrp.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes?api-version=2022-01-15-preview&continuationToken=JTVCJTdCJTIydG9rZW4lMjIlM0ElMjIlMkJSSUQlM0F%2Bc1VvbEFONFRzMHkxRHowQUFBQUFBQSUzRCUzRCUyM1JUJTNBMSUyM1RSQyUzQTUwJTIzSVNWJTNBMiUyM0lFTyUzQTY1NTUxJTIzUUNGJTNBOCUyMiUyQyUyMnJhbmdlJTIyJTNBJTdCJTIybWluJTIyJTNBJTIyJTIyJTJDJTIybWF4JTIyJTNBJTIyMDVDMURGRkZGRkZGRkMlMjIlN0QlN0QlNUQ%3D"}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples","name":"microsoft.contoso.samples","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.samples","description":"Extension + for Testing only","isSystemExtension":false,"publisher":"Microsoft Contoso + Samples","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso Samples"}}}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '28395' + - '719' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:50 GMT + - Mon, 18 Sep 2023 22:56:34 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: A34D2332E70D4C1BAD8BBC24C3760EAC Ref B: CO6AA3150218023 Ref C: 2023-09-18T22:56:34Z' status: code: 200 message: OK @@ -104,42 +107,61 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - k8s-extension extension-types list + - k8s-extension extension-types list-by-cluster Connection: - keep-alive ParameterSetName: - -g -c --cluster-type User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes?api-version=2022-01-15-preview&continuationToken=JTVCJTdCJTIydG9rZW4lMjIlM0ElMjIlMkJSSUQlM0F%2Bc1VvbEFONFRzMHkxRHowQUFBQUFBQSUzRCUzRCUyM1JUJTNBMSUyM1RSQyUzQTUwJTIzSVNWJTNBMiUyM0lFTyUzQTY1NTUxJTIzUUNGJTNBOCUyMiUyQyUyMnJhbmdlJTIyJTNBJTdCJTIybWluJTIyJTNBJTIyJTIyJTJDJTIybWF4JTIyJTNBJTIyMDVDMURGRkZGRkZGRkMlMjIlN0QlN0QlNUQ%3D + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes?api-version=2023-05-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.sandbox","name":"microsoft.networkcloud.platformcluster.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp.test","name":"microsoft.networkcloud.userrp.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.test","name":"microsoft.networkcloud.platformcluster.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.test","name":"microsoft.networkcloud.clustermanager.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.sandbox","name":"microsoft.networkcloud.clustermanager.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.staging","name":"microsoft.networkcloud.clustermanager.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.staging","name":"microsoft.networkcloud.platformcluster.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.az.edge.mqtt","name":"microsoft.az.edge.mqtt","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azedge.mqtt","name":"microsoft.azedge.mqtt","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.euap","name":"microsoft.networkcloud.platformcluster.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformcluster.prod","name":"microsoft.networkcloud.platformcluster.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.prod","name":"microsoft.networkcloud.clustermanager.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.clustermanager.euap","name":"microsoft.networkcloud.clustermanager.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp.prod","name":"microsoft.networkcloud.userrp.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.userrp.euap","name":"microsoft.networkcloud.userrp.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperatorv2","name":"cassandradatacentersoperatorv2","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.app.environment","name":"microsoft.app.environment","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"appservice"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/cassandradatacentersoperatorv3","name":"cassandradatacentersoperatorv3","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.defender.containers","name":"microsoft.defender.containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"releaseTrains":[],"clusterTypes":["Connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.clusters","name":"microsoft.contoso.clusters","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.towers","name":"microsoft.contoso.towers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"ansible"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azurebackup.kubernetes.test","name":"microsoft.azurebackup.kubernetes.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azbackup"}},"releaseTrains":[],"clusterTypes":["Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azstor","name":"microsoft.azstor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azstor"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.dev","name":"microsoft.networkcloud.platformruntime.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.test","name":"microsoft.networkcloud.platformruntime.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.staging","name":"microsoft.networkcloud.platformruntime.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.euap","name":"microsoft.networkcloud.platformruntime.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.prod","name":"microsoft.networkcloud.platformruntime.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkcloud.platformruntime.sandbox","name":"microsoft.networkcloud.platformruntime.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.networkfabricserviceextension","name":"microsoft.networkfabricserviceextension","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"managednetworkfabricservices"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest-rg/providers/Microsoft.Kubernetes/ConnectedClusters/kind-clitest-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.policyinsightshybridakstest","name":"microsoft.policyinsightshybridakstest","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","ProvisionedClusters"]}}],"nextLink":null}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.azuredefender.kubernetes","name":"microsoft.azuredefender.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.azuredefender.kubernetes","description":"Extension + for Microsoft Defender For Cloud","isSystemExtension":false,"publisher":"Microsoft.AzureDefender","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters","Provisionedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft.AzureDefender"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.policyinsights","name":"microsoft.policyinsights","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.policyinsights","description":"Extension + for microsoft.policyinsights","isSystemExtension":false,"publisher":"Microsoft.PolicyInsights","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft.PolicyInsights"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.extensionsusage","name":"microsoft.extensionsusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.extensionsusage","description":"Extension + to measure the billing","isSystemExtension":true,"publisher":"Microsoft Extension + Billing","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-extensions-usage-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Extension Billing"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/marketplace.test.01","name":"marketplace.test.01","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"marketplace.test.01","description":"Test + extension for integration tests and DVTs","isSystemExtension":false,"publisher":"marketplacetest","isManagedIdentityRequired":false,"supportedClusterTypes":["managedclusters","connectedclusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"testOffer","planId":"testPlan","publisherId":"marketplacetest"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/marketplace.test.02","name":"marketplace.test.02","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"marketplace.test.02","description":"Test + extension for marketplace integration tests and DVTs","isSystemExtension":false,"publisher":"marketplacetest2","isManagedIdentityRequired":false,"supportedClusterTypes":["connectedclusters","managedclusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"testOffer2","planId":"testPlan2","publisherId":"marketplacetest2"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.akri","name":"microsoft.akri","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.akri","description":"resource + provider for Akri project","isSystemExtension":false,"publisher":"Microsoft + Akri","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"akri"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Akri"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.tests","name":"microsoft.contoso.tests","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.tests","description":"Test + Cluster Extension for Microsoft Contoso Tests","isSystemExtension":false,"publisher":"Microsoft + Contoso Tests","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"contoso"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso Tests"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples","name":"microsoft.contoso.samples","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.samples","description":"Extension + for Testing only","isSystemExtension":false,"publisher":"Microsoft Contoso + Samples","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso Samples"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.noautoupgrade","name":"microsoft.contoso.noautoupgrade","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.noautoupgrade","description":"Test + Cluster Extension for Microsoft Contoso NoAutoUpgrade","isSystemExtension":false,"publisher":"Microsoft + Contoso NoAutoUpgrade","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"ansible"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso NoAutoUpgrade"}}}],"nextLink":null}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '17847' + - '7542' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:52 GMT + - Mon, 18 Sep 2023 22:56:35 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 687DA95F03784AED8AF87139085BB343 Ref B: CO6AA3150220025 Ref C: 2023-09-18T22:56:35Z' status: code: 200 message: OK @@ -157,39 +179,54 @@ interactions: ParameterSetName: - --location User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes?api-version=2022-01-15-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes?api-version=2023-05-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/azuremonitor-containers","name":"azuremonitor-containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.policy","name":"microsoft.policy","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.openservicemesh","name":"microsoft.openservicemesh","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc-osm-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperator","name":"cassandradatacentersoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["managedclusters","appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.apimanagement.gateway","name":"microsoft.apimanagement.gateway","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"gateway"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.web.appservice","name":"microsoft.web.appservice","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"appservice"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/ansibletoweroperator","name":"ansibletoweroperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"awx-operator"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azuredefender.kubernetes","name":"microsoft.azuredefender.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.eventgrid","name":"microsoft.eventgrid","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"eventgrid-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azureml.kubernetes","name":"microsoft.azureml.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-ml"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/dapr","name":"dapr","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"dapr-system"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurenw.mobilenetwork","name":"microsoft.azurenw.mobilenetwork","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurenw-mn"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.arcdataservices","name":"microsoft.arcdataservices","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc"}},"releaseTrains":[],"clusterTypes":["connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.scvmm","name":"microsoft.scvmm","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-vmmoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.avs","name":"microsoft.avs","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-avsoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.vmware","name":"microsoft.vmware","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-vmwareoperator"}},"releaseTrains":[],"clusterTypes":["ConnectedClusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azstackhci.operator","name":"microsoft.azstackhci.operator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azstackhci-operator"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurenw.networkfunction","name":"microsoft.azurenw.networkfunction","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-networkfunction"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azuremonitor.containers","name":"microsoft.azuremonitor.containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["ConnectedCluster","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.unitycloud.konductor","name":"microsoft.unitycloud.konductor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"konductor"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.policyinsights","name":"microsoft.policyinsights","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.cnab","name":"microsoft.cnab","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"cnab-operator"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azure.hybridnetwork","name":"microsoft.azure.hybridnetwork","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurehybridnetwork"}},"releaseTrains":[],"clusterTypes":["appliances","provisionedclusters","connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurebackup.backupagent","name":"microsoft.azurebackup.backupagent","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azurebackup"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.aksedgeoperator","name":"microsoft.aksedgeoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"aksedge-operator-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.flux","name":"microsoft.flux","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"flux-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","managedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurebackup.dataprotectionplugin","name":"microsoft.azurebackup.dataprotectionplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.containerregistry.connectedregistry","name":"microsoft.containerregistry.connectedregistry","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"connected-registry"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.dapr","name":"microsoft.dapr","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"dapr-system"}},"releaseTrains":[],"clusterTypes":["connectedCluster","managedClusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.hybridaksoperator","name":"microsoft.hybridaksoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"hybridaks-operator-system"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurekeyvaultsecretsprovider","name":"microsoft.azurekeyvaultsecretsprovider","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["connectedclusters","provisionedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.testbonsaiextension","name":"microsoft.testbonsaiextension","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperator1","name":"cassandradatacentersoperator1","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["managedclusters","appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurevote.previewstandard","name":"microsoft.azurevote.previewstandard","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"vote"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.servicelinker.connection","name":"microsoft.servicelinker.connection","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"default"}},"releaseTrains":[],"clusterTypes":["managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/deislabs.akri","name":"deislabs.akri","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"akri"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.arcextensionusage","name":"microsoft.arcextensionusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"arc-osm-system"}},"releaseTrains":[],"clusterTypes":["managedclusters","connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azure.mobilenetwork.packetcoremonitor","name":"microsoft.azure.mobilenetwork.packetcoremonitor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"packet-core-monitor"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.extensionsusage","name":"microsoft.extensionsusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-extensions-usage-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.connectedopenstack","name":"microsoft.connectedopenstack","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"connectedopenstack"}},"releaseTrains":[],"clusterTypes":["Appliances","connectedCluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp","name":"microsoft.networkcloud.userrp","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.aziot.edge","name":"microsoft.aziot.edge","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"aziotedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.appliance.management.operator","name":"microsoft.appliance.management.operator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kva-management"}},"releaseTrains":[],"clusterTypes":["Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp.dev","name":"microsoft.networkcloud.userrp.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.dev","name":"microsoft.networkcloud.clustermanager.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.dev","name":"microsoft.networkcloud.platformcluster.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.managednetworkfabric","name":"microsoft.managednetworkfabric","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"managednetworkfabric"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/ - microsoft.azurebackup.mockplugin","name":" microsoft.azurebackup.mockplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":" - namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurebackup.mockplugin","name":"microsoft.azurebackup.mockplugin","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":" - namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp.staging","name":"microsoft.networkcloud.userrp.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes?api-version=2022-01-15-preview&continuationToken=JTVCJTdCJTIydG9rZW4lMjIlM0ElMjIlMkJSSUQlM0F%2Bc1VvbEFONFRzMHkxRHowQUFBQUFBQSUzRCUzRCUyM1JUJTNBMSUyM1RSQyUzQTUwJTIzSVNWJTNBMiUyM0lFTyUzQTY1NTUxJTIzUUNGJTNBOCUyMiUyQyUyMnJhbmdlJTIyJTNBJTdCJTIybWluJTIyJTNBJTIyJTIyJTJDJTIybWF4JTIyJTNBJTIyMDVDMURGRkZGRkZGRkMlMjIlN0QlN0QlNUQ%3D"}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperator","name":"cassandradatacentersoperator","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"cassandradatacentersoperator","description":"Cassandra + data center operator","isSystemExtension":false,"publisher":"CassandraDataCenters","isManagedIdentityRequired":true,"supportedClusterTypes":["connectedclusters","managedclusters","appliances"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"planInfo":{"offerId":null,"planId":null,"publisherId":"CassandraDataCenters"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azuredefender.kubernetes","name":"microsoft.azuredefender.kubernetes","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.azuredefender.kubernetes","description":"Extension + for Microsoft Defender For Cloud","isSystemExtension":false,"publisher":"Microsoft.AzureDefender","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters","Provisionedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft.AzureDefender"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azuremonitor.containers","name":"microsoft.azuremonitor.containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.azuremonitor.containers","description":"Microsoft + Azure Monitor Containers Extension","isSystemExtension":false,"publisher":"Microsoft + Azure Monitor Containers","isManagedIdentityRequired":false,"supportedClusterTypes":["ConnectedClusters","ProvisionedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Azure Monitor Containers"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.policyinsights","name":"microsoft.policyinsights","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.policyinsights","description":"Extension + for microsoft.policyinsights","isSystemExtension":false,"publisher":"Microsoft.PolicyInsights","isManagedIdentityRequired":true,"supportedClusterTypes":["Connectedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft.PolicyInsights"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.flux","name":"microsoft.flux","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.flux","description":"Flux + Extension for controllers and CRs from the Weaveworks team","isSystemExtension":false,"publisher":"Microsoft","isManagedIdentityRequired":false,"supportedClusterTypes":["connectedclusters","managedclusters","provisionedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"flux-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azure.mobilenetwork.packetcoremonitor","name":"microsoft.azure.mobilenetwork.packetcoremonitor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.azure.mobilenetwork.packetcoremonitor","description":"Geneva + monitoring agent for Azure P5GC Packet Core","isSystemExtension":false,"publisher":"Azure + Private 5G Core Packet Core Monitor","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"packet-core-monitor"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Azure + Private 5G Core Packet Core Monitor"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.extensionsusage","name":"microsoft.extensionsusage","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.extensionsusage","description":"Extension + to measure the billing","isSystemExtension":true,"publisher":"Microsoft Extension + Billing","isManagedIdentityRequired":false,"supportedClusterTypes":["Connectedclusters","Managedclusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azure-extensions-usage-system"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Extension Billing"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.clusters","name":"microsoft.contoso.clusters","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"microsoft.contoso.clusters","description":"Test + Cluster Extension for Microsoft Contoso Clusters","isSystemExtension":false,"publisher":"Microsoft + Contoso Clusters","isManagedIdentityRequired":false,"supportedClusterTypes":null,"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"contoso"}},"planInfo":{"offerId":null,"planId":null,"publisherId":"Microsoft + Contoso Clusters"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/marketplace.test.01","name":"marketplace.test.01","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"marketplace.test.01","description":"Test + extension for integration tests and DVTs","isSystemExtension":false,"publisher":"marketplacetest","isManagedIdentityRequired":false,"supportedClusterTypes":["managedclusters","connectedclusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"testOffer","planId":"testPlan","publisherId":"marketplacetest"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/marketplace.test.02","name":"marketplace.test.02","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"marketplace.test.02","description":"Test + extension for marketplace integration tests and DVTs","isSystemExtension":false,"publisher":"marketplacetest2","isManagedIdentityRequired":false,"supportedClusterTypes":["connectedclusters","managedclusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"testOffer2","planId":"testPlan2","publisherId":"marketplacetest2"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/traefiklabs.traefikproxy","name":"traefiklabs.traefikproxy","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"traefiklabs.traefikproxy","description":"containous","isSystemExtension":false,"publisher":"containous","isManagedIdentityRequired":false,"supportedClusterTypes":["managedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"traefik"}},"planInfo":{"offerId":"traefik-proxy","planId":"traefik-proxy","publisherId":"containous"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/bitnami.redismain","name":"bitnami.redismain","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"bitnami.redismain","description":"bitnami","isSystemExtension":false,"publisher":"bitnami","isManagedIdentityRequired":true,"supportedClusterTypes":["managedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"redis-cnab","planId":"main","publisherId":"bitnami"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/isovalent.ciliumenterprise.one","name":"isovalent.ciliumenterprise.one","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"isovalent.ciliumenterprise.one","description":"isovalentinc1662143158090","isSystemExtension":false,"publisher":"isovalentinc1662143158090","isManagedIdentityRequired":true,"supportedClusterTypes":["managedClusters"],"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"planInfo":{"offerId":"isovalent-cilium-enterprise","planId":"isovalent-cilium-enterprise-base-edition","publisherId":"isovalentinc1662143158090"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/bitnami.rabbitmqmain","name":"bitnami.rabbitmqmain","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"extensionType":"bitnami.rabbitmqmain","description":"bitnami","isSystemExtension":false,"publisher":"bitnami","isManagedIdentityRequired":true,"supportedClusterTypes":["managedClusters"],"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":null}},"planInfo":{"offerId":"rabbitmq-cnab","planId":"main","publisherId":"bitnami"}}}],"nextLink":null}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '24621' + - '10583' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:53 GMT + - Mon, 18 Sep 2023 22:56:37 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 9D59D8A7540E444EA8AFC9997963AADC Ref B: CO6AA3150219023 Ref C: 2023-09-18T22:56:37Z' status: code: 200 message: OK @@ -201,42 +238,42 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - k8s-extension extension-types list-by-location + - k8s-extension extension-types list-versions-by-cluster Connection: - keep-alive ParameterSetName: - - --location + - -g -c --cluster-type --extension-type User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes?api-version=2022-01-15-preview&continuationToken=JTVCJTdCJTIydG9rZW4lMjIlM0ElMjIlMkJSSUQlM0F%2Bc1VvbEFONFRzMHkxRHowQUFBQUFBQSUzRCUzRCUyM1JUJTNBMSUyM1RSQyUzQTUwJTIzSVNWJTNBMiUyM0lFTyUzQTY1NTUxJTIzUUNGJTNBOCUyMiUyQyUyMnJhbmdlJTIyJTNBJTdCJTIybWluJTIyJTNBJTIyJTIyJTJDJTIybWF4JTIyJTNBJTIyMDVDMURGRkZGRkZGRkMlMjIlN0QlN0QlNUQ%3D + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions?showLatest=false&api-version=2023-05-01-preview response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.sandbox","name":"microsoft.networkcloud.platformcluster.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp.test","name":"microsoft.networkcloud.userrp.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.test","name":"microsoft.networkcloud.platformcluster.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.test","name":"microsoft.networkcloud.clustermanager.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.sandbox","name":"microsoft.networkcloud.clustermanager.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.staging","name":"microsoft.networkcloud.clustermanager.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.staging","name":"microsoft.networkcloud.platformcluster.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.az.edge.mqtt","name":"microsoft.az.edge.mqtt","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azedge.mqtt","name":"microsoft.azedge.mqtt","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azedge-system"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.euap","name":"microsoft.networkcloud.platformcluster.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformcluster.prod","name":"microsoft.networkcloud.platformcluster.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.prod","name":"microsoft.networkcloud.clustermanager.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.clustermanager.euap","name":"microsoft.networkcloud.clustermanager.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-cluster-manager-extension"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp.prod","name":"microsoft.networkcloud.userrp.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.userrp.euap","name":"microsoft.networkcloud.userrp.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-rp"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedcluster"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperatorv2","name":"cassandradatacentersoperatorv2","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances","ProvisionedClusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.app.environment","name":"microsoft.app.environment","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"appservice"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperatorv3","name":"cassandradatacentersoperatorv3","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.defender.containers","name":"microsoft.defender.containers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"mdc"}},"releaseTrains":[],"clusterTypes":["Connectedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.clusters","name":"microsoft.contoso.clusters","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"namespace","clusterScopeSettings":null},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.towers","name":"microsoft.contoso.towers","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":true,"defaultReleaseNamespace":"ansible"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azurebackup.kubernetes.test","name":"microsoft.azurebackup.kubernetes.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azbackup"}},"releaseTrains":[],"clusterTypes":["Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.azstor","name":"microsoft.azstor","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"azstor"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters","Appliances"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.dev","name":"microsoft.networkcloud.platformruntime.dev","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.test","name":"microsoft.networkcloud.platformruntime.test","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.staging","name":"microsoft.networkcloud.platformruntime.staging","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.euap","name":"microsoft.networkcloud.platformruntime.euap","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.prod","name":"microsoft.networkcloud.platformruntime.prod","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkcloud.platformruntime.sandbox","name":"microsoft.networkcloud.platformruntime.sandbox","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"nc-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","Managedclusters"]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.networkfabricserviceextension","name":"microsoft.networkfabricserviceextension","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"managednetworkfabricservices"}},"releaseTrains":[],"clusterTypes":[]}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.policyinsightshybridakstest","name":"microsoft.policyinsightshybridakstest","type":"Microsoft.KubernetesConfiguration/extensionTypes","properties":{"supportedScopes":{"defaultScope":"cluster","clusterScopeSettings":{"allowMultipleInstances":false,"defaultReleaseNamespace":"kube-system"}},"releaseTrains":[],"clusterTypes":["Connectedclusters","ProvisionedClusters"]}}],"nextLink":null}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.5.0","name":"1.5.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.5.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.4.0","name":"1.4.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.4.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.3.0","name":"1.3.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.3.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.1.0","name":"1.1.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.1.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.2.0","name":"1.2.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.2.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}}],"nextLink":null}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '15553' + - '2482' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:54 GMT + - Mon, 18 Sep 2023 22:56:38 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 827C0A9C301B4990A5C464FE73088844 Ref B: CO6AA3150218011 Ref C: 2023-09-18T22:56:37Z' status: code: 200 message: OK @@ -248,42 +285,136 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - k8s-extension extension-types list-versions + - k8s-extension extension-types list-versions-by-location Connection: - keep-alive ParameterSetName: - --location --extension-type User-Agent: - - AZURECLI/2.40.0 (PIP) azsdk-python-azure-mgmt-kubernetesconfiguration/2.0.0 - Python/3.10.0 (Windows-10-10.0.22621-SP0) + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions?showLatest=false&api-version=2023-05-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.5.0","name":"1.5.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.5.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.4.0","name":"1.4.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.4.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.3.0","name":"1.3.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.3.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.2.0","name":"1.2.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.2.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.1.0","name":"1.1.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.1.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}}],"nextLink":null}' + headers: + api-supported-versions: + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview + cache-control: + - no-cache + content-length: + - '2137' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 Sep 2023 22:56:38 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: BC3F1788621B4FD18637A5F38213E46F Ref B: CO6AA3150219051 Ref C: 2023-09-18T22:56:38Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension extension-types show-version-by-cluster + Connection: + - keep-alive + ParameterSetName: + - -g -c --cluster-type --extension-type --version + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.1.0?api-version=2023-05-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-tests/providers/Microsoft.Kubernetes/connectedClusters/arc-cluster/providers/Microsoft.KubernetesConfiguration/extensionTypes/microsoft.contoso.samples/versions/1.1.0","name":"1.1.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.1.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}}' + headers: + api-supported-versions: + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview + cache-control: + - no-cache + content-length: + - '490' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 18 Sep 2023 22:56:39 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-msedge-ref: + - 'Ref A: 9BA9D8FE042B4F388729471536E9A01C Ref B: CO6AA3150220021 Ref C: 2023-09-18T22:56:39Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension extension-types show-version-by-location + Connection: + - keep-alive + ParameterSetName: + - --location --extension-type --version + User-Agent: + - AZURECLI/2.48.1 azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.10.11 + (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/cassandradatacentersoperator/versions?api-version=2022-01-15-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.1.0?api-version=2023-05-01-preview response: body: - string: '{"value":[],"nextLink":null}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration/locations/eastus2euap/extensionTypes/microsoft.contoso.samples/versions/1.1.0","name":"1.1.0","type":"Microsoft.KubernetesConfiguration/extensionTypes/versions","properties":{"version":"1.1.0","unsupportedKubernetesVersions":{"connectedCluster":null,"provisionedCluster":null,"managedCluster":null,"appliances":null}}}' headers: api-supported-versions: - - 2021-05-01-preview, 2022-01-15-preview + - 2021-05-01-preview, 2022-01-15-preview, 2023-05-01-preview cache-control: - no-cache content-length: - - '28' + - '421' content-type: - application/json; charset=utf-8 date: - - Mon, 17 Oct 2022 19:14:56 GMT + - Mon, 18 Sep 2023 22:56:40 GMT expires: - '-1' pragma: - no-cache strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 154A2FEE25CC4321B20398F82C0C612E Ref B: CO6AA3150218035 Ref C: 2023-09-18T22:56:40Z' status: code: 200 message: OK diff --git a/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_scenario.py b/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_scenario.py index 04c08611f31..c0436d709fb 100644 --- a/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_scenario.py +++ b/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_scenario.py @@ -28,7 +28,7 @@ def test_k8s_extension(self): self.cmd('k8s-extension create -g {rg} -n {name} -c {cluster_name} --cluster-type {cluster_type} ' '--extension-type {extension_type} --release-train {release_train} --version {version} ' - '--configuration-settings "skipExistingDaprCheck=true" --no-wait') + '--configuration-settings "skipExistingDaprCheck=true" --no-wait --auto-upgrade false') # Update requires agent running in k8s cluster that is connected to Azure - so no update tests here # self.cmd('k8s-extension update -g {rg} -n {name} --tags foo=boo', checks=[ diff --git a/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_types_scenario.py b/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_types_scenario.py index 390b1aaab4d..d0ac7a36590 100644 --- a/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_types_scenario.py +++ b/src/k8s-extension/azext_k8s_extension/tests/latest/test_k8s_extension_types_scenario.py @@ -15,26 +15,48 @@ class K8sExtensionTypesScenarioTest(ScenarioTest): @record_only() def test_k8s_extension_types(self): - extension_type = 'cassandradatacentersoperator' + extension_type = 'microsoft.contoso.samples' self.kwargs.update({ - 'rg': 'clitest-rg', #K8sPartnerExtensionTest', - 'cluster_name': 'kind-clitest-cluster',#'k8s-extension-cluster-32469-arc', + 'rg': 'azurecli-tests', + 'cluster_name': 'arc-cluster', 'cluster_type': 'connectedClusters', 'extension_type': extension_type, - 'location': 'eastus2euap' + 'location': 'eastus2euap', + 'version': '1.1.0' }) - self.cmd('k8s-extension extension-types show -g {rg} -c {cluster_name} --cluster-type {cluster_type} ' + self.cmd('k8s-extension extension-types show-by-cluster -g {rg} -c {cluster_name} --cluster-type {cluster_type} ' '--extension-type {extension_type}', checks=[ self.check('name', '{extension_type}') ]) - extensionTypes_list = self.cmd('k8s-extension extension-types list -g {rg} -c {cluster_name} ' + self.cmd('k8s-extension extension-types show-by-location -l {location} ' + '--extension-type {extension_type}', checks=[ + self.check('name', '{extension_type}') + ]) + + extensionTypes_list = self.cmd('k8s-extension extension-types list-by-cluster -g {rg} -c {cluster_name} ' '--cluster-type {cluster_type}').get_output_in_json() assert len(extensionTypes_list) > 0 - extensionTypes_locationList = self.cmd('k8s-extension extension-types list-by-location --location ' - '{location}').get_output_in_json() + extensionTypes_locationList = self.cmd('k8s-extension extension-types list-by-location --location {location}').get_output_in_json() assert len(extensionTypes_locationList) > 0 - self.cmd('k8s-extension extension-types list-versions --location {location} --extension-type {extension_type}') + extensionTypes_list = self.cmd('k8s-extension extension-types list-versions-by-cluster -g {rg} -c {cluster_name} --cluster-type {cluster_type} --extension-type {extension_type}').get_output_in_json() + + assert len(extensionTypes_list) > 0 + + extensionTypes_list = self.cmd('k8s-extension extension-types list-versions-by-location --location {location} --extension-type {extension_type}').get_output_in_json() + + assert len(extensionTypes_list) > 0 + + extensionTypes_list = self.cmd('k8s-extension extension-types show-version-by-cluster -g {rg} -c {cluster_name} --cluster-type {cluster_type} --extension-type {extension_type} --version {version}').get_output_in_json() + + assert len(extensionTypes_list) > 0 + + extensionTypes_list = self.cmd('k8s-extension extension-types show-version-by-location --location {location} --extension-type {extension_type} --version {version}').get_output_in_json() + + assert len(extensionTypes_list) > 0 + + + diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py index ea88227c594..ece4e8f4f3e 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py @@ -36,9 +36,8 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - **kwargs # type: Any + **kwargs: Any ): - # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -53,9 +52,8 @@ def __init__( def _configure( self, - **kwargs # type: Any + **kwargs: 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) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_serialization.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_serialization.py index 240df16c57f..e3cc6ce6ed6 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_serialization.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,34 +38,50 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull -_BOM = codecs.BOM_UTF8.decode(encoding='utf-8') +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r'^(application|text)/([a-z+.]+\+)?json$') + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") # Name used in context CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -75,12 +92,12 @@ def deserialize_from_text(cls, data, content_type=None): :type data: str or bytes or IO :param str content_type: The content type. """ - if hasattr(data, 'read'): + if hasattr(data, "read"): # Assume a stream data = cast(IO, data).read() if isinstance(data, bytes): - data_as_str = data.decode(encoding='utf-8-sig') + data_as_str = data.decode(encoding="utf-8-sig") else: # Explain to mypy the correct type. data_as_str = cast(str, data) @@ -116,7 +133,8 @@ def _json_attemp(data): try: return True, json.loads(data) except ValueError: - return False, None # Don't care about this one + return False, None # Don't care about this one + success, json_result = _json_attemp(data) if success: return json_result @@ -129,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -139,8 +156,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): """ # Try to use content-type from headers if available content_type = None - if 'content-type' in headers: - content_type = headers['content-type'].split(";")[0].strip().lower() + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() # Ouch, this server did not declare what it sent... # Let's guess it's JSON... # Also, since Autorest was considering that an empty body was a valid JSON, @@ -152,20 +169,22 @@ def deserialize_from_http_generics(cls, body_bytes, headers): return cls.deserialize_from_text(body_bytes, content_type) return None + try: basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) try: - _long_type = long # type: ignore + _long_type = long # type: ignore except NameError: _long_type = int + class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" @@ -181,9 +200,11 @@ def dst(self, dt): """No daylight saving for UTC.""" return datetime.timedelta(hours=1) + try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 + class _FixedOffset(datetime.tzinfo): # type: ignore """Fixed offset in minutes east from UTC. Copy/pasted from Python doc @@ -197,7 +218,7 @@ def utcoffset(self, dt): return self.__offset def tzname(self, dt): - return str(self.__offset.total_seconds()/3600) + return str(self.__offset.total_seconds() / 3600) def __repr__(self): return "".format(self.tzname(None)) @@ -208,14 +229,17 @@ def dst(self, dt): def __getinitargs__(self): return (self.__offset,) + try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore _FLATTEN = re.compile(r"(? None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -276,47 +304,42 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): - cls._attribute_map['additional_properties'] = {'key': '', 'type': '{object}'} + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @classmethod def _create_xml_node(cls): - """Create XML node. - """ + """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} - return _create_xml_node( - xml_map.get('name', cls.__name__), - xml_map.get("prefix", None), - xml_map.get("ns", None) - ) + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -330,8 +353,15 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[ + [str, Dict[str, Any], Any], Any + ] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -367,7 +397,7 @@ def my_key_transformer(key, attr_desc, value): @classmethod def _infer_class_models(cls): try: - str_models = cls.__module__.rsplit('.', 1)[0] + str_models = cls.__module__.rsplit(".", 1)[0] models = sys.modules[str_models] client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: @@ -378,7 +408,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -390,7 +420,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -403,16 +438,20 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor - ] if key_extractors is None else key_extractors + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) return deserializer(cls.__name__, data, content_type=content_type) @classmethod def _flatten_subtype(cls, key, objects): - if '_subtype_map' not in cls.__dict__: + if "_subtype_map" not in cls.__dict__: return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): @@ -425,18 +464,14 @@ def _classify(cls, response, objects): We want to ignore any inherited _subtype_maps. Remove the polymorphic key from the initial data. """ - for subtype_key in cls.__dict__.get('_subtype_map', {}).keys(): + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) else: - subtype_value = xml_key_extractor( - subtype_key, - cls._attribute_map[subtype_key], - response - ) + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: # Try to match base class. Can be class name only # (bug to fix in Autorest to support x-ms-discriminator-name) @@ -444,7 +479,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -453,11 +488,7 @@ def _classify(cls, response, objects): ) break else: - _LOGGER.warning( - "Discriminator %s is absent or null, use base class %s.", - subtype_key, - cls.__name__ - ) + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) break return cls @@ -468,29 +499,40 @@ def _get_rest_key_parts(cls, attr_key): :returns: A list of RestAPI part :rtype: list """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]['key']) + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] def _decode_attribute_map_key(key): """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. + inside the received data. - :param str key: A key string from the generated code + :param str key: A key string from the generated code """ - return key.replace('\\.', '.') + return key.replace("\\.", ".") class Serializer(object): """Request object model serializer.""" - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} - - _xml_basic_types_serializers = {'bool': lambda x:str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", - 4: "Fri", 5: "Sat", 6: "Sun"} - months = {1: "Jan", 2: "Feb", 3: "Mar", 4: "Apr", 5: "May", 6: "Jun", - 7: "Jul", 8: "Aug", 9: "Sep", 10: "Oct", 11: "Nov", 12: "Dec"} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } validation = { "min_length": lambda x, y: len(x) < y, "max_length": lambda x, y: len(x) > y, @@ -502,26 +544,26 @@ class Serializer(object): "max_items": lambda x, y: len(x) > y, "pattern": lambda x, y: not re.match(y, x, re.UNICODE), "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0 - } + "multiple": lambda x, y: x % y != 0, + } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.serialize_type = { - 'iso-8601': Serializer.serialize_iso, - 'rfc-1123': Serializer.serialize_rfc, - 'unix-time': Serializer.serialize_unix, - 'duration': Serializer.serialize_duration, - 'date': Serializer.serialize_date, - 'time': Serializer.serialize_time, - 'decimal': Serializer.serialize_decimal, - 'long': Serializer.serialize_long, - 'bytearray': Serializer.serialize_bytearray, - 'base64': Serializer.serialize_base64, - 'object': self.serialize_object, - '[]': self.serialize_iter, - '{}': self.serialize_dict - } - self.dependencies = dict(classes) if classes else {} + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -542,14 +584,12 @@ def _serialize(self, target_obj, data_type=None, **kwargs): class_name = target_obj.__class__.__name__ if data_type: - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) if not hasattr(target_obj, "_attribute_map"): data_type = type(target_obj).__name__ if data_type in self.basic_types.values(): - return self.serialize_data( - target_obj, data_type, **kwargs) + return self.serialize_data(target_obj, data_type, **kwargs) # Force "is_xml" kwargs if we detect a XML model try: @@ -564,10 +604,10 @@ def _serialize(self, target_obj, data_type=None, **kwargs): attributes = target_obj._attribute_map for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get('readonly', False): + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): continue - if attr_name == "additional_properties" and attr_desc["key"] == '': + if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: serialized.update(target_obj.additional_properties) continue @@ -575,68 +615,60 @@ def _serialize(self, target_obj, data_type=None, **kwargs): orig_attr = getattr(target_obj, attr) if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) keys = keys if isinstance(keys, list) else [keys] - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc['type'], **kwargs) - + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) if is_xml_model_serialization: - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) - xml_prefix = xml_desc.get('prefix', None) - xml_ns = xml_desc.get('ns', None) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if 'name' not in getattr(orig_attr, '_xml_map', {}): + if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace + if len(splitted_tag) == 2: # Namespace new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary - local_node = _create_xml_node( - xml_name, - xml_prefix, - xml_ns - ) + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format( - attr_name, class_name, str(target_obj)) + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise_with_traceback(SerializationError, msg, err) else: return serialized @@ -652,8 +684,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip('[]{}') - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -668,19 +700,18 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: deserializer.key_extractors = [ rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor + last_rest_key_case_insensitive_extractor, ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback( - SerializationError, "Unable to build a model: "+str(err), err) + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) return self._serialize(data, data_type, **kwargs) @@ -695,13 +726,13 @@ def url(self, name, data, data_type, **kwargs): """ try: output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -720,27 +751,19 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [ - self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" - for d - in data - ] - if not kwargs.get('skip_quote', False): - data = [ - quote(str(d), safe='') - for d - in data - ] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] return str(self.serialize_iter(data, internal_data_type, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) - if kwargs.get('skip_quote') is True: + if kwargs.get("skip_quote") is True: output = str(output) else: - output = quote(str(output), safe='') + output = quote(str(output), safe="") except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) else: @@ -756,11 +779,11 @@ def header(self, name, data, data_type, **kwargs): :raises: ValueError if data is None """ try: - if data_type in ['[str]']: + if data_type in ["[str]"]: data = ["" if d is None else d for d in data] output = self.serialize_data(data, data_type, **kwargs) - if data_type == 'bool': + if data_type == "bool": output = json.dumps(output) except SerializationError: raise TypeError("{} must be type {}.".format(name, data_type)) @@ -782,6 +805,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -796,13 +821,11 @@ def serialize_data(self, data, data_type, **kwargs): iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: - return self.serialize_type[iter_type]( - data, data_type[1:-1], **kwargs) + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback( - SerializationError, msg.format(data, data_type), err) + raise_with_traceback(SerializationError, msg.format(data, data_type), err) else: return self._serialize(data, **kwargs) @@ -829,7 +852,7 @@ def serialize_basic(cls, data, data_type, **kwargs): custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) - if data_type == 'str': + if data_type == "str": return cls.serialize_unicode(data) return eval(data_type)(data) # nosec @@ -847,7 +870,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -886,25 +909,21 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialized.append(None) if div: - serialized = ['' if s is None else str(s) for s in serialized] + serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) - if 'xml' in serialization_ctxt or is_xml: + if "xml" in serialization_ctxt or is_xml: # XML serialization is more complicated - xml_desc = serialization_ctxt.get('xml', {}) - xml_name = xml_desc.get('name') + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") if not xml_name: - xml_name = serialization_ctxt['key'] + xml_name = serialization_ctxt["key"] # Create a wrap node if necessary (use the fact that Element and list have "append") is_wrapped = xml_desc.get("wrapped", False) node_name = xml_desc.get("itemsName", xml_name) if is_wrapped: - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) else: final_result = [] # All list elements to "local_node" @@ -912,11 +931,7 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): if isinstance(el, ET.Element): el_node = el else: - el_node = _create_xml_node( - node_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) if el is not None: # Otherwise it writes "None" :-p el_node.text = str(el) final_result.append(el_node) @@ -936,21 +951,16 @@ def serialize_dict(self, attr, dict_type, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_data( - value, dict_type, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None - if 'xml' in serialization_ctxt: + if "xml" in serialization_ctxt: # XML serialization is more complicated - xml_desc = serialization_ctxt['xml'] - xml_name = xml_desc['name'] + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] - final_result = _create_xml_node( - xml_name, - xml_desc.get('prefix', None), - xml_desc.get('ns', None) - ) + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) for key, value in serialized.items(): ET.SubElement(final_result, key).text = value return final_result @@ -996,8 +1006,7 @@ def serialize_object(self, attr, **kwargs): serialized = {} for key, value in attr.items(): try: - serialized[self.serialize_unicode(key)] = self.serialize_object( - value, **kwargs) + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) except ValueError: serialized[self.serialize_unicode(key)] = None return serialized @@ -1006,8 +1015,7 @@ def serialize_object(self, attr, **kwargs): serialized = [] for obj in attr: try: - serialized.append(self.serialize_object( - obj, **kwargs)) + serialized.append(self.serialize_object(obj, **kwargs)) except ValueError: pass return serialized @@ -1020,10 +1028,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1045,8 +1053,8 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr).decode('ascii') - return encoded.strip('=').replace('+', '-').replace('/', '_') + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod def serialize_decimal(attr, **kwargs): @@ -1113,16 +1121,20 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], utc.tm_mday, - Serializer.months[utc.tm_mon], utc.tm_year, - utc.tm_hour, utc.tm_min, utc.tm_sec) + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) @staticmethod def serialize_iso(attr, **kwargs): @@ -1136,19 +1148,18 @@ def serialize_iso(attr, **kwargs): attr = isodate.parse_datetime(attr) try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") - microseconds = str(attr.microsecond).rjust(6,'0').rstrip('0').ljust(3, '0') + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") if microseconds: - microseconds = '.'+microseconds + microseconds = "." + microseconds date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, - utc.tm_hour, utc.tm_min, utc.tm_sec) - return date + microseconds + 'Z' + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) @@ -1169,18 +1180,19 @@ def serialize_unix(attr, **kwargs): return attr try: if not attr.tzinfo: - _LOGGER.warning( - "Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") + def rest_key_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: - dict_keys = _FLATTEN.split(key) + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1191,15 +1203,16 @@ def rest_key_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) return working_data.get(key) + def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc['key'] + key = attr_desc["key"] working_data = data - while '.' in key: + while "." in key: dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) @@ -1211,30 +1224,33 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): # that all properties under are None as well # https://github.com/Azure/msrest-for-python/issues/197 return None - key = '.'.join(dict_keys[1:]) + key = ".".join(dict_keys[1:]) if working_data: return attribute_key_case_insensitive_extractor(key, None, working_data) + def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - """ - key = attr_desc['key'] + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) + def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" """ - key = attr_desc['key'] + key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + def attribute_key_extractor(attr, _, data): return data.get(attr) + def attribute_key_case_insensitive_extractor(attr, _, data): found_key = None lower_attr = attr.lower() @@ -1245,6 +1261,7 @@ def attribute_key_case_insensitive_extractor(attr, _, data): return data.get(found_key) + def _extract_name_from_internal_type(internal_type): """Given an internal type XML description, extract correct XML name with namespace. @@ -1253,10 +1270,10 @@ def _extract_name_from_internal_type(internal_type): :returns: A tuple XML name + namespace dict """ internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get('name', internal_type.__name__) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1268,19 +1285,19 @@ def xml_key_extractor(attr, attr_desc, data): if not isinstance(data, ET.Element): return None - xml_desc = attr_desc.get('xml', {}) - xml_name = xml_desc.get('name', attr_desc['key']) + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) # Look for a children - is_iter_type = attr_desc['type'].startswith("[") + is_iter_type = attr_desc["type"].startswith("[") is_wrapped = xml_desc.get("wrapped", False) internal_type = attr_desc.get("internalType", None) internal_type_xml_map = getattr(internal_type, "_xml_map", {}) # Integrate namespace if necessary - xml_ns = xml_desc.get('ns', internal_type_xml_map.get("ns", None)) + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1294,15 +1311,15 @@ def xml_key_extractor(attr, attr_desc, data): # - Wrapped node # - Internal type is an enum (considered basic types) # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or 'name' not in internal_type_xml_map)): + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): children = data.findall(xml_name) # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and 'name' in internal_type_xml_map: + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: xml_name = _extract_name_from_internal_type(internal_type) children = data.findall(xml_name) # That's an array else: - if internal_type: # Complex type, ignore itemsName and use the complex type name + if internal_type: # Complex type, ignore itemsName and use the complex type name items_name = _extract_name_from_internal_type(internal_type) else: items_name = xml_desc.get("itemsName", xml_name) @@ -1311,21 +1328,22 @@ def xml_key_extractor(attr, attr_desc, data): if len(children) == 0: if is_iter_type: if is_wrapped: - return None # is_wrapped no node, we want None + return None # is_wrapped no node, we want None else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) + else: # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name - )) + ) + ) return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty @@ -1333,6 +1351,7 @@ def xml_key_extractor(attr, attr_desc, data): raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) return children[0] + class Deserializer(object): """Response object model deserializer. @@ -1340,37 +1359,32 @@ class Deserializer(object): :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. """ - basic_types = {str: 'str', int: 'int', bool: 'bool', float: 'float'} + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile( - r'\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}' - r'\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?') + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): self.deserialize_type = { - 'iso-8601': Deserializer.deserialize_iso, - 'rfc-1123': Deserializer.deserialize_rfc, - 'unix-time': Deserializer.deserialize_unix, - 'duration': Deserializer.deserialize_duration, - 'date': Deserializer.deserialize_date, - 'time': Deserializer.deserialize_time, - 'decimal': Deserializer.deserialize_decimal, - 'long': Deserializer.deserialize_long, - 'bytearray': Deserializer.deserialize_bytearray, - 'base64': Deserializer.deserialize_base64, - 'object': self.deserialize_object, - '[]': self.deserialize_iter, - '{}': self.deserialize_dict - } + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } self.deserialize_expected_types = { - 'duration': (isodate.Duration, datetime.timedelta), - 'iso-8601': (datetime.datetime) + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [ - rest_key_extractor, - xml_key_extractor - ] + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much # complicated, with no real scenario for now. @@ -1403,8 +1417,7 @@ def _deserialize(self, target_obj, data): """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, '_validation', {}).items() - if config.get('constant')] + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: for attr, mapconfig in data._attribute_map.items(): if attr in constants: @@ -1412,15 +1425,11 @@ def _deserialize(self, target_obj, data): value = getattr(data, attr) if value is None: continue - local_type = mapconfig['type'] - internal_data_type = local_type.strip('[]{}') + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): continue - setattr( - data, - attr, - self._deserialize(local_type, value) - ) + setattr(data, attr, self._deserialize(local_type, value)) return data except AttributeError: return @@ -1435,16 +1444,16 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == '': + if attr == "additional_properties" and attr_desc["key"] == "": continue raw_value = None # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip('[]{}') + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") if internal_data_type in self.dependencies: attr_desc["internalType"] = self.dependencies[internal_data_type] @@ -1452,21 +1461,18 @@ def _deserialize(self, target_obj, data): found_value = key_extractor(attr, attr_desc, data) if found_value is not None: if raw_value is not None and raw_value != found_value: - msg = ("Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" ) - _LOGGER.warning( - msg, - found_value, - key_extractor, - attr + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" ) + _LOGGER.warning(msg, found_value, key_extractor, attr) continue raw_value = found_value - value = self.deserialize_data(raw_value, attr_desc['type']) + value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1475,14 +1481,17 @@ def _deserialize(self, target_obj, data): def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != '': + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": # Check empty string. If it's not empty, someone has a real "additionalProperties" return None if isinstance(data, ET.Element): data = {el.tag: el.text for el in data} - known_keys = {_decode_attribute_map_key(_FLATTEN.split(desc['key'])[0]) - for desc in attribute_map.values() if desc['key'] != ''} + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } present_keys = set(data.keys()) missing_keys = present_keys - known_keys return {key: data[key] for key in missing_keys} @@ -1493,7 +1502,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1508,7 +1517,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1518,15 +1527,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: return self(target_obj, data, content_type=content_type) except: _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", - exc_info=True + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None @@ -1554,22 +1562,16 @@ def _unpack_content(raw_data, content_type=None): return context[RawDeserializer.CONTEXT_NAME] raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - #Assume this is enough to recognize universal_http.ClientResponse without importing it + # Assume this is enough to recognize universal_http.ClientResponse without importing it if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text(), - raw_data.headers - ) + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, '_content_consumed'): - return RawDeserializer.deserialize_from_http_generics( - raw_data.text, - raw_data.headers - ) + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, 'read'): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1579,14 +1581,11 @@ def _instantiate_model(self, response, attrs, additional_properties=None): :param d_attrs: The deserialized response attributes. """ if callable(response): - subtype = getattr(response, '_subtype_map', {}) + subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() - if v.get('readonly')] - const = [k for k, v in response._validation.items() - if v.get('constant')] - kwargs = {k: v for k, v in attrs.items() - if k not in subtype and k not in readonly + const} + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) @@ -1594,8 +1593,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format( - kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1659,13 +1657,10 @@ def deserialize_iter(self, attr, iter_type): """ if attr is None: return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children + if isinstance(attr, ET.Element): # If I receive an element here, get the children attr = list(attr) if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format( - iter_type, - type(attr) - )) + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) return [self.deserialize_data(a, iter_type) for a in attr] def deserialize_dict(self, attr, dict_type): @@ -1677,7 +1672,7 @@ def deserialize_dict(self, attr, dict_type): :rtype: dict """ if isinstance(attr, list): - return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr} + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} if isinstance(attr, ET.Element): # Transform value into {"Key": "value"} @@ -1698,7 +1693,7 @@ def deserialize_object(self, attr, **kwargs): # Do no recurse on XML, just return the tree as-is return attr if isinstance(attr, basestring): - return self.deserialize_basic(attr, 'str') + return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: return self.deserialize_basic(attr, self.basic_types[obj_type]) @@ -1709,8 +1704,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = {} for key, value in attr.items(): try: - deserialized[key] = self.deserialize_object( - value, **kwargs) + deserialized[key] = self.deserialize_object(value, **kwargs) except ValueError: deserialized[key] = None return deserialized @@ -1719,8 +1713,7 @@ def deserialize_object(self, attr, **kwargs): deserialized = [] for obj in attr: try: - deserialized.append(self.deserialize_object( - obj, **kwargs)) + deserialized.append(self.deserialize_object(obj, **kwargs)) except ValueError: pass return deserialized @@ -1747,23 +1740,23 @@ def deserialize_basic(self, attr, data_type): if not attr: if data_type == "str": # None or '', node is empty string. - return '' + return "" else: # None or '', node with a strong type is None. # Don't try to model "empty bool" or "empty int" return None - if data_type == 'bool': + if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) elif isinstance(attr, basestring): - if attr.lower() in ['true', '1']: + if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ['false', '0']: + elif attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) - if data_type == 'str': + if data_type == "str": return self.deserialize_unicode(attr) return eval(data_type)(attr) # nosec @@ -1782,7 +1775,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1833,7 +1826,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1845,9 +1838,9 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = '=' * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace('-', '+').replace('_', '/') + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @staticmethod @@ -1861,7 +1854,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1876,7 +1869,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1890,7 +1883,7 @@ def deserialize_duration(attr): attr = attr.text try: duration = isodate.parse_duration(attr) - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1906,7 +1899,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1921,7 +1914,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1936,10 +1929,9 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], - tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0)/60)) + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -1960,12 +1952,12 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) - check_decimal = attr.split('.') + check_decimal = attr.split(".") if len(check_decimal) > 1: decimal_str = "" for digit in check_decimal[1]: @@ -1980,7 +1972,7 @@ def deserialize_iso(attr): test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - except(ValueError, OverflowError, AttributeError) as err: + except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise_with_traceback(DeserializationError, msg, err) else: @@ -1996,7 +1988,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_source_control_configuration_client.py index 6ac92536c1b..b1e5664c3a4 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_source_control_configuration_client.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_source_control_configuration_client.py @@ -53,7 +53,7 @@ class SourceControlConfigurationClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-11-01' + DEFAULT_API_VERSION = '2023-05-01' _PROFILE_TAG = "azure.mgmt.kubernetesconfiguration.SourceControlConfigurationClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -73,10 +73,10 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version=None, # type: Optional[str] + api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile=KnownProfiles.default, # type: KnownProfiles - **kwargs # type: Any + profile: KnownProfiles=KnownProfiles.default, + **kwargs: Any ): self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -105,6 +105,8 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` * 2022-07-01: :mod:`v2022_07_01.models` * 2022-11-01: :mod:`v2022_11_01.models` + * 2023-05-01: :mod:`v2023_05_01.models` + * 2023-05-01-preview: :mod:`v2023_05_01_preview.models` """ if api_version == '2020-07-01-preview': from .v2020_07_01_preview import models @@ -142,6 +144,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-11-01': from .v2022_11_01 import models return models + elif api_version == '2023-05-01': + from .v2023_05_01 import models + return models + elif api_version == '2023-05-01-preview': + from .v2023_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -213,6 +221,22 @@ def extension_type_versions(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def extension_types(self): + """Instance depends on the API version: + + * 2023-05-01-preview: :class:`ExtensionTypesOperations` + """ + api_version = self._get_api_version('extension_types') + if api_version == '2023-05-01-preview': + from .v2023_05_01_preview.operations import ExtensionTypesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'extension_types'".format(api_version)) + self._config.api_version = api_version + # Remove this after testing is done for 2023-05-01-preview + self._client._base_url = "https://management.azure.com" + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def extensions(self): """Instance depends on the API version: @@ -227,6 +251,7 @@ def extensions(self): * 2022-04-02-preview: :class:`ExtensionsOperations` * 2022-07-01: :class:`ExtensionsOperations` * 2022-11-01: :class:`ExtensionsOperations` + * 2023-05-01: :class:`ExtensionsOperations` """ api_version = self._get_api_version('extensions') if api_version == '2020-07-01-preview': @@ -249,6 +274,8 @@ def extensions(self): from .v2022_07_01.operations import ExtensionsOperations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import ExtensionsOperations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import ExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'extensions'".format(api_version)) self._config.api_version = api_version @@ -264,6 +291,7 @@ def flux_config_operation_status(self): * 2022-03-01: :class:`FluxConfigOperationStatusOperations` * 2022-07-01: :class:`FluxConfigOperationStatusOperations` * 2022-11-01: :class:`FluxConfigOperationStatusOperations` + * 2023-05-01: :class:`FluxConfigOperationStatusOperations` """ api_version = self._get_api_version('flux_config_operation_status') if api_version == '2021-11-01-preview': @@ -278,6 +306,8 @@ def flux_config_operation_status(self): from .v2022_07_01.operations import FluxConfigOperationStatusOperations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import FluxConfigOperationStatusOperations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import FluxConfigOperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_config_operation_status'".format(api_version)) self._config.api_version = api_version @@ -293,6 +323,7 @@ def flux_configurations(self): * 2022-03-01: :class:`FluxConfigurationsOperations` * 2022-07-01: :class:`FluxConfigurationsOperations` * 2022-11-01: :class:`FluxConfigurationsOperations` + * 2023-05-01: :class:`FluxConfigurationsOperations` """ api_version = self._get_api_version('flux_configurations') if api_version == '2021-11-01-preview': @@ -307,6 +338,8 @@ def flux_configurations(self): from .v2022_07_01.operations import FluxConfigurationsOperations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import FluxConfigurationsOperations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import FluxConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'flux_configurations'".format(api_version)) self._config.api_version = api_version @@ -348,6 +381,8 @@ def operation_status(self): * 2022-04-02-preview: :class:`OperationStatusOperations` * 2022-07-01: :class:`OperationStatusOperations` * 2022-11-01: :class:`OperationStatusOperations` + * 2023-05-01: :class:`OperationStatusOperations` + * 2023-05-01-preview: :class:`OperationStatusOperations` """ api_version = self._get_api_version('operation_status') if api_version == '2021-05-01-preview': @@ -368,6 +403,10 @@ def operation_status(self): from .v2022_07_01.operations import OperationStatusOperations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import OperationStatusOperations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import OperationStatusOperations as OperationClass + elif api_version == '2023-05-01-preview': + from .v2023_05_01_preview.operations import OperationStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'operation_status'".format(api_version)) self._config.api_version = api_version @@ -388,6 +427,8 @@ def operations(self): * 2022-03-01: :class:`Operations` * 2022-07-01: :class:`Operations` * 2022-11-01: :class:`Operations` + * 2023-05-01: :class:`Operations` + * 2023-05-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2020-07-01-preview': @@ -412,6 +453,10 @@ def operations(self): from .v2022_07_01.operations import Operations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import Operations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import Operations as OperationClass + elif api_version == '2023-05-01-preview': + from .v2023_05_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -473,6 +518,7 @@ def source_control_configurations(self): * 2022-03-01: :class:`SourceControlConfigurationsOperations` * 2022-07-01: :class:`SourceControlConfigurationsOperations` * 2022-11-01: :class:`SourceControlConfigurationsOperations` + * 2023-05-01: :class:`SourceControlConfigurationsOperations` """ api_version = self._get_api_version('source_control_configurations') if api_version == '2020-07-01-preview': @@ -495,6 +541,8 @@ def source_control_configurations(self): from .v2022_07_01.operations import SourceControlConfigurationsOperations as OperationClass elif api_version == '2022-11-01': from .v2022_11_01.operations import SourceControlConfigurationsOperations as OperationClass + elif api_version == '2023-05-01': + from .v2023_05_01.operations import SourceControlConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'source_control_configurations'".format(api_version)) self._config.api_version = api_version diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_version.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_version.py index 48944bf3938..a30a458f8b5 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_version.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_version.py @@ -1,9 +1,8 @@ # 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. +# Licensed under the MIT License. See License.txt in the project root for +# license information. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "0.1.0" \ No newline at end of file diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models.py index c172941ccce..9979cbfa0aa 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models.py @@ -6,4 +6,4 @@ # -------------------------------------------------------------------------- from .v2022_01_15_preview.models import * from .v2022_04_02_preview.models import * -from .v2022_11_01.models import * +from .v2023_05_01.models import * diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/__init__.py new file mode 100644 index 00000000000..3ad4bd8b604 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/__init__.py @@ -0,0 +1,26 @@ +# 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 ._source_control_configuration_client import SourceControlConfigurationClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SourceControlConfigurationClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_configuration.py new file mode 100644 index 00000000000..04ecbde73e8 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SourceControlConfigurationClient. + + 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. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-05-01") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".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.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 = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_source_control_configuration_client.py new file mode 100644 index 00000000000..a1fdbed24c1 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_source_control_configuration_client.py @@ -0,0 +1,126 @@ +# 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 copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ( + ExtensionsOperations, + FluxConfigOperationStatusOperations, + FluxConfigurationsOperations, + OperationStatusOperations, + Operations, + SourceControlConfigurationsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword + """KubernetesConfiguration Client. + + :ivar extensions: ExtensionsOperations operations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.OperationStatusOperations + :ivar flux_configurations: FluxConfigurationsOperations operations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.FluxConfigurationsOperations + :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.FluxConfigOperationStatusOperations + :ivar source_control_configurations: SourceControlConfigurationsOperations operations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.SourceControlConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.v2023_05_01.operations.Operations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = 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._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flux_configurations = FluxConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flux_config_operation_status = FluxConfigOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_control_configurations = SourceControlConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "SourceControlConfigurationClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_vendor.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_vendor.py new file mode 100644 index 00000000000..bd0df84f531 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_version.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_version.py new file mode 100644 index 00000000000..59deb8c7263 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.1.0" diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/__init__.py new file mode 100644 index 00000000000..b95230ae03c --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/__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 ._source_control_configuration_client import SourceControlConfigurationClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SourceControlConfigurationClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_configuration.py new file mode 100644 index 00000000000..fcf3f1ae427 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/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, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SourceControlConfigurationClient. + + 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. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + api_version: str = kwargs.pop("api_version", "2023-05-01") + + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".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 = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_source_control_configuration_client.py new file mode 100644 index 00000000000..0f224c04726 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/_source_control_configuration_client.py @@ -0,0 +1,126 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ( + ExtensionsOperations, + FluxConfigOperationStatusOperations, + FluxConfigurationsOperations, + OperationStatusOperations, + Operations, + SourceControlConfigurationsOperations, +) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword + """KubernetesConfiguration Client. + + :ivar extensions: ExtensionsOperations operations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.OperationStatusOperations + :ivar flux_configurations: FluxConfigurationsOperations operations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.FluxConfigurationsOperations + :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.FluxConfigOperationStatusOperations + :ivar source_control_configurations: SourceControlConfigurationsOperations operations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.SourceControlConfigurationsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = 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._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flux_configurations = FluxConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.flux_config_operation_status = FluxConfigOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_control_configurations = SourceControlConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SourceControlConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/__init__.py new file mode 100644 index 00000000000..9d58b5443a0 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/__init__.py @@ -0,0 +1,29 @@ +# 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 ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._flux_configurations_operations import FluxConfigurationsOperations +from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations +from ._source_control_configurations_operations import SourceControlConfigurationsOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ExtensionsOperations", + "OperationStatusOperations", + "FluxConfigurationsOperations", + "FluxConfigOperationStatusOperations", + "SourceControlConfigurationsOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_extensions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_extensions_operations.py new file mode 100644 index 00000000000..52c7d9ddbe8 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_extensions_operations.py @@ -0,0 +1,946 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._extensions_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: Union[_models.Extension, IO], + **kwargs: Any + ) -> _models.Extension: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension, (IOBase, bytes)): + _content = extension + else: + _json = self._serialize.body(extension, "Extension") + + request = build_create_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: _models.Extension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Required. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Required. + :type extension: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: Union[_models.Extension, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Is either a Extension type or a + IO type. Required. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Extension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> _models.Extension: + """Gets Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Extension or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension + from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. Default value is None. + :type force_delete: bool + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + async def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: Union[_models.PatchExtension, IO], + **kwargs: Any + ) -> _models.Extension: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_extension, (IOBase, bytes)): + _content = patch_extension + else: + _json = self._serialize.body(patch_extension, "PatchExtension") + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: _models.PatchExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Required. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Required. + :type patch_extension: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: Union[_models.PatchExtension, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Is either a + PatchExtension type or a IO type. Required. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Extension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.Extension"]: + """List all Extensions in the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 Extension or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py new file mode 100644 index 00000000000..4ba8f8bb704 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py @@ -0,0 +1,137 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._flux_config_operation_status_operations import build_get_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FluxConfigOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`flux_config_operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatusResult: + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_configurations_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_configurations_operations.py new file mode 100644 index 00000000000..0e6c8829d2f --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_flux_configurations_operations.py @@ -0,0 +1,951 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._flux_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FluxConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`flux_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> _models.FluxConfiguration: + """Gets details of the Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FluxConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: Union[_models.FluxConfiguration, IO], + **kwargs: Any + ) -> _models.FluxConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flux_configuration, (IOBase, bytes)): + _content = flux_configuration + else: + _json = self._serialize.body(flux_configuration, "FluxConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: _models.FluxConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required. + :type flux_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: Union[_models.FluxConfiguration, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a + FluxConfiguration type or a IO type. Required. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration=flux_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + async def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO], + **kwargs: Any + ) -> _models.FluxConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flux_configuration_patch, (IOBase, bytes)): + _content = flux_configuration_patch + else: + _json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: _models.FluxConfigurationPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + Required. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + Required. + :type flux_configuration_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is + either a FluxConfigurationPatch type or a IO type. Required. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration_patch=flux_configuration_patch, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync + from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. Default value is None. + :type force_delete: bool + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FluxConfiguration"]: + """List all Flux Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 FluxConfiguration or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operation_status_operations.py new file mode 100644 index 00000000000..344c1181570 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operation_status_operations.py @@ -0,0 +1,242 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatusResult: + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OperationStatusResult"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operations.py new file mode 100644 index 00000000000..55f7617c121 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_operations.py @@ -0,0 +1,135 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"} diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_source_control_configurations_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_source_control_configurations_operations.py new file mode 100644 index 00000000000..921aadb7680 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/aio/operations/_source_control_configurations_operations.py @@ -0,0 +1,574 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._source_control_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SourceControlConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.aio.SourceControlConfigurationClient`'s + :attr:`source_control_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Gets details of the Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: _models.SourceControlConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + Required. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + Required. + :type source_control_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: Union[_models.SourceControlConfiguration, IO], + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is + either a SourceControlConfiguration type or a IO type. Required. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(source_control_configuration, (IOBase, bytes)): + _content = source_control_configuration + else: + _json = self._serialize.body(source_control_configuration, "SourceControlConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This will delete the YAML file used to set up the Source control configuration, thus stopping + future sync from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, 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, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SourceControlConfiguration"]: + """List all Source Control Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 SourceControlConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/__init__.py new file mode 100644 index 00000000000..955dab7fdbc --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/__init__.py @@ -0,0 +1,137 @@ +# 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 ._models_py3 import AzureBlobDefinition +from ._models_py3 import AzureBlobPatchDefinition +from ._models_py3 import BucketDefinition +from ._models_py3 import BucketPatchDefinition +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import GitRepositoryPatchDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import KustomizationPatchDefinition +from ._models_py3 import ManagedIdentityDefinition +from ._models_py3 import ManagedIdentityPatchDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import Plan +from ._models_py3 import PostBuildDefinition +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import ServicePrincipalDefinition +from ._models_py3 import ServicePrincipalPatchDefinition +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SubstituteFromDefinition +from ._models_py3 import SystemData + +from ._source_control_configuration_client_enums import AKSIdentityType +from ._source_control_configuration_client_enums import ComplianceStateType +from ._source_control_configuration_client_enums import CreatedByType +from ._source_control_configuration_client_enums import FluxComplianceState +from ._source_control_configuration_client_enums import KustomizationValidationType +from ._source_control_configuration_client_enums import LevelType +from ._source_control_configuration_client_enums import MessageLevelType +from ._source_control_configuration_client_enums import OperatorScopeType +from ._source_control_configuration_client_enums import OperatorType +from ._source_control_configuration_client_enums import ProvisioningState +from ._source_control_configuration_client_enums import ProvisioningStateType +from ._source_control_configuration_client_enums import ScopeType +from ._source_control_configuration_client_enums import SourceKindType +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AzureBlobDefinition", + "AzureBlobPatchDefinition", + "BucketDefinition", + "BucketPatchDefinition", + "ComplianceStatus", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "Extension", + "ExtensionPropertiesAksAssignedIdentity", + "ExtensionStatus", + "ExtensionsList", + "FluxConfiguration", + "FluxConfigurationPatch", + "FluxConfigurationsList", + "GitRepositoryDefinition", + "GitRepositoryPatchDefinition", + "HelmOperatorProperties", + "HelmReleasePropertiesDefinition", + "Identity", + "KustomizationDefinition", + "KustomizationPatchDefinition", + "ManagedIdentityDefinition", + "ManagedIdentityPatchDefinition", + "ObjectReferenceDefinition", + "ObjectStatusConditionDefinition", + "ObjectStatusDefinition", + "OperationStatusList", + "OperationStatusResult", + "PatchExtension", + "Plan", + "PostBuildDefinition", + "ProxyResource", + "RepositoryRefDefinition", + "Resource", + "ResourceProviderOperation", + "ResourceProviderOperationDisplay", + "ResourceProviderOperationList", + "Scope", + "ScopeCluster", + "ScopeNamespace", + "ServicePrincipalDefinition", + "ServicePrincipalPatchDefinition", + "SourceControlConfiguration", + "SourceControlConfigurationList", + "SubstituteFromDefinition", + "SystemData", + "AKSIdentityType", + "ComplianceStateType", + "CreatedByType", + "FluxComplianceState", + "KustomizationValidationType", + "LevelType", + "MessageLevelType", + "OperatorScopeType", + "OperatorType", + "ProvisioningState", + "ProvisioningStateType", + "ScopeType", + "SourceKindType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_models_py3.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_models_py3.py new file mode 100644 index 00000000000..2bc1090d26f --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_models_py3.py @@ -0,0 +1,2796 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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 datetime +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class AzureBlobDefinition(_serialization.Model): + """Parameters to reconcile to the AzureBlob source kind type. + + :ivar url: The URL to sync for the flux configuration Azure Blob storage account. + :vartype url: str + :ivar container_name: The Azure Blob container name to sync from the url endpoint for the flux + configuration. + :vartype container_name: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob + source with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob + source with the remote. + :vartype sync_interval_in_seconds: int + :ivar service_principal: Parameters to authenticate using Service Principal. + :vartype service_principal: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ServicePrincipalDefinition + :ivar account_key: The account key (shared key) to access the storage account. + :vartype account_key: str + :ivar sas_token: The Shared Access token to access the storage container. + :vartype sas_token: str + :ivar managed_identity: Parameters to authenticate using a Managed Identity. + :vartype managed_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ManagedIdentityDefinition + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "service_principal": {"key": "servicePrincipal", "type": "ServicePrincipalDefinition"}, + "account_key": {"key": "accountKey", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, + "managed_identity": {"key": "managedIdentity", "type": "ManagedIdentityDefinition"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + container_name: Optional[str] = None, + timeout_in_seconds: int = 600, + sync_interval_in_seconds: int = 600, + service_principal: Optional["_models.ServicePrincipalDefinition"] = None, + account_key: Optional[str] = None, + sas_token: Optional[str] = None, + managed_identity: Optional["_models.ManagedIdentityDefinition"] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration Azure Blob storage account. + :paramtype url: str + :keyword container_name: The Azure Blob container name to sync from the url endpoint for the + flux configuration. + :paramtype container_name: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob + source with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob + source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword service_principal: Parameters to authenticate using Service Principal. + :paramtype service_principal: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ServicePrincipalDefinition + :keyword account_key: The account key (shared key) to access the storage account. + :paramtype account_key: str + :keyword sas_token: The Shared Access token to access the storage container. + :paramtype sas_token: str + :keyword managed_identity: Parameters to authenticate using a Managed Identity. + :paramtype managed_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ManagedIdentityDefinition + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.container_name = container_name + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.service_principal = service_principal + self.account_key = account_key + self.sas_token = sas_token + self.managed_identity = managed_identity + self.local_auth_ref = local_auth_ref + + +class AzureBlobPatchDefinition(_serialization.Model): + """Parameters to reconcile to the AzureBlob source kind type. + + :ivar url: The URL to sync for the flux configuration Azure Blob storage account. + :vartype url: str + :ivar container_name: The Azure Blob container name to sync from the url endpoint for the flux + configuration. + :vartype container_name: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob + source with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob + source with the remote. + :vartype sync_interval_in_seconds: int + :ivar service_principal: Parameters to authenticate using Service Principal. + :vartype service_principal: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ServicePrincipalPatchDefinition + :ivar account_key: The account key (shared key) to access the storage account. + :vartype account_key: str + :ivar sas_token: The Shared Access token to access the storage container. + :vartype sas_token: str + :ivar managed_identity: Parameters to authenticate using a Managed Identity. + :vartype managed_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ManagedIdentityPatchDefinition + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "service_principal": {"key": "servicePrincipal", "type": "ServicePrincipalPatchDefinition"}, + "account_key": {"key": "accountKey", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, + "managed_identity": {"key": "managedIdentity", "type": "ManagedIdentityPatchDefinition"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + container_name: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + service_principal: Optional["_models.ServicePrincipalPatchDefinition"] = None, + account_key: Optional[str] = None, + sas_token: Optional[str] = None, + managed_identity: Optional["_models.ManagedIdentityPatchDefinition"] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration Azure Blob storage account. + :paramtype url: str + :keyword container_name: The Azure Blob container name to sync from the url endpoint for the + flux configuration. + :paramtype container_name: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob + source with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob + source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword service_principal: Parameters to authenticate using Service Principal. + :paramtype service_principal: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ServicePrincipalPatchDefinition + :keyword account_key: The account key (shared key) to access the storage account. + :paramtype account_key: str + :keyword sas_token: The Shared Access token to access the storage container. + :paramtype sas_token: str + :keyword managed_identity: Parameters to authenticate using a Managed Identity. + :paramtype managed_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ManagedIdentityPatchDefinition + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.container_name = container_name + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.service_principal = service_principal + self.account_key = account_key + self.sas_token = sas_token + self.managed_identity = managed_identity + self.local_auth_ref = local_auth_ref + + +class BucketDefinition(_serialization.Model): + """Parameters to reconcile to the Bucket source kind type. + + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source + with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket source + with the remote. + :vartype sync_interval_in_seconds: int + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "bucket_name": {"key": "bucketName", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "access_key": {"key": "accessKey", "type": "str"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + bucket_name: Optional[str] = None, + insecure: bool = True, + timeout_in_seconds: int = 600, + sync_interval_in_seconds: int = 600, + access_key: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source + with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket + source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.bucket_name = bucket_name + self.insecure = insecure + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.access_key = access_key + self.local_auth_ref = local_auth_ref + + +class BucketPatchDefinition(_serialization.Model): + """Parameters to reconcile to the Bucket source kind type. + + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source + with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket source + with the remote. + :vartype sync_interval_in_seconds: int + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "bucket_name": {"key": "bucketName", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "access_key": {"key": "accessKey", "type": "str"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + bucket_name: Optional[str] = None, + insecure: Optional[bool] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + access_key: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source + with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket + source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.bucket_name = bucket_name + self.insecure = insecure + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.access_key = access_key + self.local_auth_ref = local_auth_ref + + +class ComplianceStatus(_serialization.Model): + """Compliance Status details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar compliance_state: The compliance state of the configuration. Known values are: "Pending", + "Compliant", "Noncompliant", "Installed", and "Failed". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ComplianceStateType + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Known values are: "Error", "Warning", and + "Information". + :vartype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.MessageLevelType + """ + + _validation = { + "compliance_state": {"readonly": True}, + } + + _attribute_map = { + "compliance_state": {"key": "complianceState", "type": "str"}, + "last_config_applied": {"key": "lastConfigApplied", "type": "iso-8601"}, + "message": {"key": "message", "type": "str"}, + "message_level": {"key": "messageLevel", "type": "str"}, + } + + def __init__( + self, + *, + last_config_applied: Optional[datetime.datetime] = None, + message: Optional[str] = None, + message_level: Optional[Union[str, "_models.MessageLevelType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Known values are: "Error", "Warning", and + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.MessageLevelType + """ + super().__init__(**kwargs) + self.compliance_state = None + self.last_config_applied = last_config_applied + self.message = message + self.message_level = message_level + + +class ErrorAdditionalInfo(_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: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_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[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_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.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class Resource(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = 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: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes + """The Extension object. + + 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 identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Identity + :ivar system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData + :ivar plan: The plan information. + :vartype plan: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Plan + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: User-specified version of the extension for this extension to 'pin'. To use + 'version', autoUpgradeMinorVersion must be 'false'. + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :vartype configuration_protected_settings: dict[str, str] + :ivar current_version: Currently installed version of the extension. + :vartype current_version: str + :ivar provisioning_state: Status of installation of this extension. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ProvisioningState + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ExtensionStatus] + :ivar error_info: Error information from the Agent - e.g. errors during installation. + :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ErrorDetail + :ivar custom_location_settings: Custom Location settings properties. + :vartype custom_location_settings: dict[str, str] + :ivar package_uri: Uri of the Helm package. + :vartype package_uri: str + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ExtensionPropertiesAksAssignedIdentity + :ivar is_system_extension: Flag to note if this extension is a system extension. + :vartype is_system_extension: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "current_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "error_info": {"readonly": True}, + "custom_location_settings": {"readonly": True}, + "package_uri": {"readonly": True}, + "is_system_extension": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "plan": {"key": "plan", "type": "Plan"}, + "extension_type": {"key": "properties.extensionType", "type": "str"}, + "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, + "release_train": {"key": "properties.releaseTrain", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "scope": {"key": "properties.scope", "type": "Scope"}, + "configuration_settings": {"key": "properties.configurationSettings", "type": "{str}"}, + "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"}, + "current_version": {"key": "properties.currentVersion", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "statuses": {"key": "properties.statuses", "type": "[ExtensionStatus]"}, + "error_info": {"key": "properties.errorInfo", "type": "ErrorDetail"}, + "custom_location_settings": {"key": "properties.customLocationSettings", "type": "{str}"}, + "package_uri": {"key": "properties.packageUri", "type": "str"}, + "aks_assigned_identity": { + "key": "properties.aksAssignedIdentity", + "type": "ExtensionPropertiesAksAssignedIdentity", + }, + "is_system_extension": {"key": "properties.isSystemExtension", "type": "bool"}, + } + + def __init__( + self, + *, + identity: Optional["_models.Identity"] = None, + plan: Optional["_models.Plan"] = None, + extension_type: Optional[str] = None, + auto_upgrade_minor_version: bool = True, + release_train: str = "Stable", + version: Optional[str] = None, + scope: Optional["_models.Scope"] = None, + configuration_settings: Optional[Dict[str, str]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + statuses: Optional[List["_models.ExtensionStatus"]] = None, + aks_assigned_identity: Optional["_models.ExtensionPropertiesAksAssignedIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Identity + :keyword plan: The plan information. + :paramtype plan: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Plan + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: User-specified version of the extension for this extension to 'pin'. To use + 'version', autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ExtensionPropertiesAksAssignedIdentity + """ + super().__init__(**kwargs) + self.identity = identity + self.system_data = None + self.plan = plan + self.extension_type = extension_type + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.release_train = release_train + self.version = version + self.scope = scope + self.configuration_settings = configuration_settings + self.configuration_protected_settings = configuration_protected_settings + self.current_version = None + self.provisioning_state = None + self.statuses = statuses + self.error_info = None + self.custom_location_settings = None + self.package_uri = None + self.aks_assigned_identity = aks_assigned_identity + self.is_system_extension = None + + +class ExtensionPropertiesAksAssignedIdentity(_serialization.Model): + """Identity of the Extension resource in an AKS cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Known values are: "SystemAssigned" and "UserAssigned". + :vartype type: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AKSIdentityType + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.AKSIdentityType"]] = None, **kwargs: Any) -> None: + """ + :keyword type: The identity type. Known values are: "SystemAssigned" and "UserAssigned". + :paramtype type: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AKSIdentityType + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class ExtensionsList(_serialization.Model): + """Result of the request to list Extensions. It contains a list of Extension objects and a 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 Extensions within a Kubernetes cluster. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :ivar next_link: URL to get the next set of extension objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Extension]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ExtensionStatus(_serialization.Model): + """Status from the extension. + + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Known values are: "Error", "Warning", and "Information". + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "display_status": {"key": "displayStatus", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "time": {"key": "time", "type": "str"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + display_status: Optional[str] = None, + level: Union[str, "_models.LevelType"] = "Information", + message: Optional[str] = None, + time: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Known values are: "Error", "Warning", and "Information". + :paramtype level: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ + super().__init__(**kwargs) + self.code = code + self.display_status = display_status + self.level = level + self.message = message + self.time = time + + +class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes + """The Flux Configuration object returned in Get & Put response. + + 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 system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData + :ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and + "namespace". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Known values are: + "GitRepository", "Bucket", and "AzureBlob". + :vartype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceKindType + :ivar suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.GitRepositoryDefinition + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.BucketDefinition + :ivar azure_blob: Parameters to reconcile to the AzureBlob source kind type. + :vartype azure_blob: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AzureBlobDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :vartype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.KustomizationDefinition] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] + :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or + created by the managed objects provisioned by the fluxConfiguration. + :vartype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectStatusDefinition] + :ivar repository_public_key: Public Key associated with this fluxConfiguration (either + generated within the cluster or provided by the user). + :vartype repository_public_key: str + :ivar source_synced_commit_id: Branch and/or SHA of the source commit synced with the cluster. + :vartype source_synced_commit_id: str + :ivar source_updated_at: Datetime the fluxConfiguration synced its source on the cluster. + :vartype source_updated_at: ~datetime.datetime + :ivar status_updated_at: Datetime the fluxConfiguration synced its status on the cluster with + Azure. + :vartype status_updated_at: ~datetime.datetime + :ivar wait_for_reconciliation: Whether flux configuration deployment should wait for cluster to + reconcile the kustomizations. + :vartype wait_for_reconciliation: bool + :ivar reconciliation_wait_duration: Maximum duration to wait for flux configuration + reconciliation. E.g PT1H, PT5M, P1D. + :vartype reconciliation_wait_duration: str + :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the + fluxConfiguration or created by the managed objects. Known values are: "Compliant", + "Non-Compliant", "Pending", "Suspended", and "Unknown". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxComplianceState + :ivar provisioning_state: Status of the creation of the fluxConfiguration. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ProvisioningState + :ivar error_message: Error message returned to the user in the case of provisioning failure. + :vartype error_message: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "statuses": {"readonly": True}, + "repository_public_key": {"readonly": True}, + "source_synced_commit_id": {"readonly": True}, + "source_updated_at": {"readonly": True}, + "status_updated_at": {"readonly": True}, + "compliance_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "error_message": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "scope": {"key": "properties.scope", "type": "str"}, + "namespace": {"key": "properties.namespace", "type": "str"}, + "source_kind": {"key": "properties.sourceKind", "type": "str"}, + "suspend": {"key": "properties.suspend", "type": "bool"}, + "git_repository": {"key": "properties.gitRepository", "type": "GitRepositoryDefinition"}, + "bucket": {"key": "properties.bucket", "type": "BucketDefinition"}, + "azure_blob": {"key": "properties.azureBlob", "type": "AzureBlobDefinition"}, + "kustomizations": {"key": "properties.kustomizations", "type": "{KustomizationDefinition}"}, + "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"}, + "statuses": {"key": "properties.statuses", "type": "[ObjectStatusDefinition]"}, + "repository_public_key": {"key": "properties.repositoryPublicKey", "type": "str"}, + "source_synced_commit_id": {"key": "properties.sourceSyncedCommitId", "type": "str"}, + "source_updated_at": {"key": "properties.sourceUpdatedAt", "type": "iso-8601"}, + "status_updated_at": {"key": "properties.statusUpdatedAt", "type": "iso-8601"}, + "wait_for_reconciliation": {"key": "properties.waitForReconciliation", "type": "bool"}, + "reconciliation_wait_duration": {"key": "properties.reconciliationWaitDuration", "type": "str"}, + "compliance_state": {"key": "properties.complianceState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "error_message": {"key": "properties.errorMessage", "type": "str"}, + } + + def __init__( + self, + *, + scope: Union[str, "_models.ScopeType"] = "cluster", + namespace: str = "default", + source_kind: Optional[Union[str, "_models.SourceKindType"]] = None, + suspend: bool = False, + git_repository: Optional["_models.GitRepositoryDefinition"] = None, + bucket: Optional["_models.BucketDefinition"] = None, + azure_blob: Optional["_models.AzureBlobDefinition"] = None, + kustomizations: Optional[Dict[str, "_models.KustomizationDefinition"]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + wait_for_reconciliation: Optional[bool] = None, + reconciliation_wait_duration: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword scope: Scope at which the operator will be installed. Known values are: "cluster" and + "namespace". + :paramtype scope: str or ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Known values are: + "GitRepository", "Bucket", and "AzureBlob". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.GitRepositoryDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.BucketDefinition + :keyword azure_blob: Parameters to reconcile to the AzureBlob source kind type. + :paramtype azure_blob: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AzureBlobDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword wait_for_reconciliation: Whether flux configuration deployment should wait for cluster + to reconcile the kustomizations. + :paramtype wait_for_reconciliation: bool + :keyword reconciliation_wait_duration: Maximum duration to wait for flux configuration + reconciliation. E.g PT1H, PT5M, P1D. + :paramtype reconciliation_wait_duration: str + """ + super().__init__(**kwargs) + self.system_data = None + self.scope = scope + self.namespace = namespace + self.source_kind = source_kind + self.suspend = suspend + self.git_repository = git_repository + self.bucket = bucket + self.azure_blob = azure_blob + self.kustomizations = kustomizations + self.configuration_protected_settings = configuration_protected_settings + self.statuses = None + self.repository_public_key = None + self.source_synced_commit_id = None + self.source_updated_at = None + self.status_updated_at = None + self.wait_for_reconciliation = wait_for_reconciliation + self.reconciliation_wait_duration = reconciliation_wait_duration + self.compliance_state = None + self.provisioning_state = None + self.error_message = None + + +class FluxConfigurationPatch(_serialization.Model): + """The Flux Configuration Patch Request object. + + :ivar source_kind: Source Kind to pull the configuration data from. Known values are: + "GitRepository", "Bucket", and "AzureBlob". + :vartype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceKindType + :ivar suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.GitRepositoryPatchDefinition + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.BucketPatchDefinition + :ivar azure_blob: Parameters to reconcile to the AzureBlob source kind type. + :vartype azure_blob: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AzureBlobPatchDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :vartype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.KustomizationPatchDefinition] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] + """ + + _attribute_map = { + "source_kind": {"key": "properties.sourceKind", "type": "str"}, + "suspend": {"key": "properties.suspend", "type": "bool"}, + "git_repository": {"key": "properties.gitRepository", "type": "GitRepositoryPatchDefinition"}, + "bucket": {"key": "properties.bucket", "type": "BucketPatchDefinition"}, + "azure_blob": {"key": "properties.azureBlob", "type": "AzureBlobPatchDefinition"}, + "kustomizations": {"key": "properties.kustomizations", "type": "{KustomizationPatchDefinition}"}, + "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"}, + } + + def __init__( + self, + *, + source_kind: Optional[Union[str, "_models.SourceKindType"]] = None, + suspend: Optional[bool] = None, + git_repository: Optional["_models.GitRepositoryPatchDefinition"] = None, + bucket: Optional["_models.BucketPatchDefinition"] = None, + azure_blob: Optional["_models.AzureBlobPatchDefinition"] = None, + kustomizations: Optional[Dict[str, "_models.KustomizationPatchDefinition"]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source_kind: Source Kind to pull the configuration data from. Known values are: + "GitRepository", "Bucket", and "AzureBlob". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.GitRepositoryPatchDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.BucketPatchDefinition + :keyword azure_blob: Parameters to reconcile to the AzureBlob source kind type. + :paramtype azure_blob: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.AzureBlobPatchDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.KustomizationPatchDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ + super().__init__(**kwargs) + self.source_kind = source_kind + self.suspend = suspend + self.git_repository = git_repository + self.bucket = bucket + self.azure_blob = azure_blob + self.kustomizations = kustomizations + self.configuration_protected_settings = configuration_protected_settings + + +class FluxConfigurationsList(_serialization.Model): + """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration + objects and a 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 Flux Configurations within a Kubernetes cluster. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :ivar next_link: URL to get the next set of configuration objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FluxConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class GitRepositoryDefinition(_serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: int + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.RepositoryRefDefinition + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + access private git repositories over SSH. + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "repository_ref": {"key": "repositoryRef", "type": "RepositoryRefDefinition"}, + "ssh_known_hosts": {"key": "sshKnownHosts", "type": "str"}, + "https_user": {"key": "httpsUser", "type": "str"}, + "https_ca_cert": {"key": "httpsCACert", "type": "str"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + timeout_in_seconds: int = 600, + sync_interval_in_seconds: int = 600, + repository_ref: Optional["_models.RepositoryRefDefinition"] = None, + ssh_known_hosts: Optional[str] = None, + https_user: Optional[str] = None, + https_ca_cert: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.repository_ref = repository_ref + self.ssh_known_hosts = ssh_known_hosts + self.https_user = https_user + self.https_ca_cert = https_ca_cert + self.local_auth_ref = local_auth_ref + + +class GitRepositoryPatchDefinition(_serialization.Model): + """Parameters to reconcile to the GitRepository source kind type. + + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + source with the remote. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :vartype sync_interval_in_seconds: int + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.RepositoryRefDefinition + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + access private git repositories over SSH. + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :vartype local_auth_ref: str + """ + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "repository_ref": {"key": "repositoryRef", "type": "RepositoryRefDefinition"}, + "ssh_known_hosts": {"key": "sshKnownHosts", "type": "str"}, + "https_user": {"key": "httpsUser", "type": "str"}, + "https_ca_cert": {"key": "httpsCACert", "type": "str"}, + "local_auth_ref": {"key": "localAuthRef", "type": "str"}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + repository_ref: Optional["_models.RepositoryRefDefinition"] = None, + ssh_known_hosts: Optional[str] = None, + https_user: Optional[str] = None, + https_ca_cert: Optional[str] = None, + local_auth_ref: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: int + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ + super().__init__(**kwargs) + self.url = url + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.repository_ref = repository_ref + self.ssh_known_hosts = ssh_known_hosts + self.https_user = https_user + self.https_ca_cert = https_ca_cert + self.local_auth_ref = local_auth_ref + + +class HelmOperatorProperties(_serialization.Model): + """Properties for Helm operator. + + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str + """ + + _attribute_map = { + "chart_version": {"key": "chartVersion", "type": "str"}, + "chart_values": {"key": "chartValues", "type": "str"}, + } + + def __init__( + self, *, chart_version: Optional[str] = None, chart_values: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ + super().__init__(**kwargs) + self.chart_version = chart_version + self.chart_values = chart_values + + +class HelmReleasePropertiesDefinition(_serialization.Model): + """Properties for HelmRelease objects. + + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: int + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :vartype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectReferenceDefinition + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: int + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: int + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: int + """ + + _attribute_map = { + "last_revision_applied": {"key": "lastRevisionApplied", "type": "int"}, + "helm_chart_ref": {"key": "helmChartRef", "type": "ObjectReferenceDefinition"}, + "failure_count": {"key": "failureCount", "type": "int"}, + "install_failure_count": {"key": "installFailureCount", "type": "int"}, + "upgrade_failure_count": {"key": "upgradeFailureCount", "type": "int"}, + } + + def __init__( + self, + *, + last_revision_applied: Optional[int] = None, + helm_chart_ref: Optional["_models.ObjectReferenceDefinition"] = None, + failure_count: Optional[int] = None, + install_failure_count: Optional[int] = None, + upgrade_failure_count: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: int + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: int + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: int + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: int + """ + super().__init__(**kwargs) + self.last_revision_applied = last_revision_applied + self.helm_chart_ref = helm_chart_ref + self.failure_count = failure_count + self.install_failure_count = install_failure_count + self.upgrade_failure_count = upgrade_failure_count + + +class Identity(_serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Default value is "SystemAssigned". + :vartype type: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: + """ + :keyword type: The identity type. Default value is "SystemAssigned". + :paramtype type: str + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class KustomizationDefinition(_serialization.Model): + """The Kustomization defining how to reconcile the artifact pulled by the source type on the + cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Kustomization, matching the key in the Kustomizations object map. + :vartype name: str + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :vartype depends_on: list[str] + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster. + :vartype sync_interval_in_seconds: int + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: int + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool + :ivar wait: Enable/disable health check for all Kubernetes objects created by this + Kustomization. + :vartype wait: bool + :ivar post_build: Used for variable substitution for this Kustomization after kustomize build. + :vartype post_build: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PostBuildDefinition + """ + + _validation = { + "name": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "depends_on": {"key": "dependsOn", "type": "[str]"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "retry_interval_in_seconds": {"key": "retryIntervalInSeconds", "type": "int"}, + "prune": {"key": "prune", "type": "bool"}, + "force": {"key": "force", "type": "bool"}, + "wait": {"key": "wait", "type": "bool"}, + "post_build": {"key": "postBuild", "type": "PostBuildDefinition"}, + } + + def __init__( + self, + *, + path: str = "", + depends_on: Optional[List[str]] = None, + timeout_in_seconds: int = 600, + sync_interval_in_seconds: int = 600, + retry_interval_in_seconds: Optional[int] = None, + prune: bool = False, + force: bool = False, + wait: bool = True, + post_build: Optional["_models.PostBuildDefinition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: list[str] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: int + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: int + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + :keyword wait: Enable/disable health check for all Kubernetes objects created by this + Kustomization. + :paramtype wait: bool + :keyword post_build: Used for variable substitution for this Kustomization after kustomize + build. + :paramtype post_build: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PostBuildDefinition + """ + super().__init__(**kwargs) + self.name = None + self.path = path + self.depends_on = depends_on + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.retry_interval_in_seconds = retry_interval_in_seconds + self.prune = prune + self.force = force + self.wait = wait + self.post_build = post_build + + +class KustomizationPatchDefinition(_serialization.Model): + """The Kustomization defining how to reconcile the artifact pulled by the source type on the + cluster. + + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :vartype depends_on: list[str] + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :vartype timeout_in_seconds: int + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster. + :vartype sync_interval_in_seconds: int + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: int + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool + :ivar wait: Enable/disable health check for all Kubernetes objects created by this + Kustomization. + :vartype wait: bool + :ivar post_build: Used for variable substitution for this Kustomization after kustomize build. + :vartype post_build: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PostBuildDefinition + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "depends_on": {"key": "dependsOn", "type": "[str]"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"}, + "retry_interval_in_seconds": {"key": "retryIntervalInSeconds", "type": "int"}, + "prune": {"key": "prune", "type": "bool"}, + "force": {"key": "force", "type": "bool"}, + "wait": {"key": "wait", "type": "bool"}, + "post_build": {"key": "postBuild", "type": "PostBuildDefinition"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + depends_on: Optional[List[str]] = None, + timeout_in_seconds: Optional[int] = None, + sync_interval_in_seconds: Optional[int] = None, + retry_interval_in_seconds: Optional[int] = None, + prune: Optional[bool] = None, + force: Optional[bool] = None, + wait: Optional[bool] = None, + post_build: Optional["_models.PostBuildDefinition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: list[str] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: int + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: int + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: int + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + :keyword wait: Enable/disable health check for all Kubernetes objects created by this + Kustomization. + :paramtype wait: bool + :keyword post_build: Used for variable substitution for this Kustomization after kustomize + build. + :paramtype post_build: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PostBuildDefinition + """ + super().__init__(**kwargs) + self.path = path + self.depends_on = depends_on + self.timeout_in_seconds = timeout_in_seconds + self.sync_interval_in_seconds = sync_interval_in_seconds + self.retry_interval_in_seconds = retry_interval_in_seconds + self.prune = prune + self.force = force + self.wait = wait + self.post_build = post_build + + +class ManagedIdentityDefinition(_serialization.Model): + """Parameters to authenticate using a Managed Identity. + + :ivar client_id: The client Id for authenticating a Managed Identity. + :vartype client_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, *, client_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: The client Id for authenticating a Managed Identity. + :paramtype client_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + + +class ManagedIdentityPatchDefinition(_serialization.Model): + """Parameters to authenticate using a Managed Identity. + + :ivar client_id: The client Id for authenticating a Managed Identity. + :vartype client_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, *, client_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: The client Id for authenticating a Managed Identity. + :paramtype client_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + + +class ObjectReferenceDefinition(_serialization.Model): + """Object reference to a Kubernetes object on a cluster. + + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + + +class ObjectStatusConditionDefinition(_serialization.Model): + """Status condition of Kubernetes object. + + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str + """ + + _attribute_map = { + "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"}, + "message": {"key": "message", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + last_transition_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + reason: Optional[str] = None, + status: Optional[str] = None, + type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ + super().__init__(**kwargs) + self.last_transition_time = last_transition_time + self.message = message + self.reason = reason + self.status = status + self.type = type + + +class ObjectStatusDefinition(_serialization.Model): + """Statuses of objects deployed by the user-specified kustomizations from the git repository. + + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Known values are: "Compliant", + "Non-Compliant", "Pending", "Suspended", and "Unknown". + :vartype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxComplianceState + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectReferenceDefinition + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectStatusConditionDefinition] + :ivar helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :vartype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.HelmReleasePropertiesDefinition + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "compliance_state": {"key": "complianceState", "type": "str"}, + "applied_by": {"key": "appliedBy", "type": "ObjectReferenceDefinition"}, + "status_conditions": {"key": "statusConditions", "type": "[ObjectStatusConditionDefinition]"}, + "helm_release_properties": {"key": "helmReleaseProperties", "type": "HelmReleasePropertiesDefinition"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + kind: Optional[str] = None, + compliance_state: Union[str, "_models.FluxComplianceState"] = "Unknown", + applied_by: Optional["_models.ObjectReferenceDefinition"] = None, + status_conditions: Optional[List["_models.ObjectStatusConditionDefinition"]] = None, + helm_release_properties: Optional["_models.HelmReleasePropertiesDefinition"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Known values are: "Compliant", + "Non-Compliant", "Pending", "Suspended", and "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.HelmReleasePropertiesDefinition + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + self.kind = kind + self.compliance_state = compliance_state + self.applied_by = applied_by + self.status_conditions = status_conditions + self.helm_release_properties = helm_release_properties + + +class OperationStatusList(_serialization.Model): + """The async operations in progress, in the cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of async operations in progress, in the cluster. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult] + :ivar next_link: URL to get the next set of Operation Result objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OperationStatusResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. + + 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 ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ErrorDetail + """ + + _validation = { + "status": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = None + + +class PatchExtension(_serialization.Model): + """The Extension Patch Request object. + + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :vartype configuration_protected_settings: dict[str, str] + """ + + _attribute_map = { + "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, + "release_train": {"key": "properties.releaseTrain", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "configuration_settings": {"key": "properties.configurationSettings", "type": "{str}"}, + "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"}, + } + + def __init__( + self, + *, + auto_upgrade_minor_version: bool = True, + release_train: str = "Stable", + version: Optional[str] = None, + configuration_settings: Optional[Dict[str, str]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ + super().__init__(**kwargs) + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.release_train = release_train + self.version = version + self.configuration_settings = configuration_settings + self.configuration_protected_settings = configuration_protected_settings + + +class Plan(_serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :vartype name: str + :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + Required. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str + """ + + _validation = { + "name": {"required": True}, + "publisher": {"required": True}, + "product": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: A user defined name of the 3rd Party Artifact that is being procured. Required. + :paramtype name: str + :keyword publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. Required. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to + the OfferID specified for the artifact at the time of Data Market onboarding. Required. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class PostBuildDefinition(_serialization.Model): + """The postBuild definitions defining variable substitutions for this Kustomization after + kustomize build. + + :ivar substitute: Key/value pairs holding the variables to be substituted in this + Kustomization. + :vartype substitute: dict[str, str] + :ivar substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted for + this Kustomization. + :vartype substitute_from: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SubstituteFromDefinition] + """ + + _attribute_map = { + "substitute": {"key": "substitute", "type": "{str}"}, + "substitute_from": {"key": "substituteFrom", "type": "[SubstituteFromDefinition]"}, + } + + def __init__( + self, + *, + substitute: Optional[Dict[str, str]] = None, + substitute_from: Optional[List["_models.SubstituteFromDefinition"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword substitute: Key/value pairs holding the variables to be substituted in this + Kustomization. + :paramtype substitute: dict[str, str] + :keyword substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted + for this Kustomization. + :paramtype substitute_from: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SubstituteFromDefinition] + """ + super().__init__(**kwargs) + self.substitute = substitute + self.substitute_from = substitute_from + + +class RepositoryRefDefinition(_serialization.Model): + """The source reference for the GitRepository object. + + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to + be valid. This takes precedence over semver. + :vartype commit: str + """ + + _attribute_map = { + "branch": {"key": "branch", "type": "str"}, + "tag": {"key": "tag", "type": "str"}, + "semver": {"key": "semver", "type": "str"}, + "commit": {"key": "commit", "type": "str"}, + } + + def __init__( + self, + *, + branch: Optional[str] = None, + tag: Optional[str] = None, + semver: Optional[str] = None, + commit: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ + super().__init__(**kwargs) + self.branch = branch + self.tag = tag + self.semver = semver + self.commit = commit + + +class ResourceProviderOperation(_serialization.Model): + """Supported operation of this resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperationDisplay + :ivar is_data_action: The flag that indicates whether the operation applies to data plane. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + _validation = { + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "origin": {"key": "origin", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.ResourceProviderOperationDisplay"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperationDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + self.is_data_action = None + self.origin = None + + +class ResourceProviderOperationDisplay(_serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(_serialization.Model): + """Result of the request to list operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by this resource provider. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperation] + :ivar next_link: URL to the next set of results, if any. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceProviderOperation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ResourceProviderOperation"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperation] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class Scope(_serialization.Model): + """Scope of the extension. It can be either Cluster or Namespace; but not both. + + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeNamespace + """ + + _attribute_map = { + "cluster": {"key": "cluster", "type": "ScopeCluster"}, + "namespace": {"key": "namespace", "type": "ScopeNamespace"}, + } + + def __init__( + self, + *, + cluster: Optional["_models.ScopeCluster"] = None, + namespace: Optional["_models.ScopeNamespace"] = None, + **kwargs: Any + ) -> None: + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ScopeNamespace + """ + super().__init__(**kwargs) + self.cluster = cluster + self.namespace = namespace + + +class ScopeCluster(_serialization.Model): + """Specifies that the scope of the extension is Cluster. + + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :vartype release_namespace: str + """ + + _attribute_map = { + "release_namespace": {"key": "releaseNamespace", "type": "str"}, + } + + def __init__(self, *, release_namespace: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ + super().__init__(**kwargs) + self.release_namespace = release_namespace + + +class ScopeNamespace(_serialization.Model): + """Specifies that the scope of the extension is Namespace. + + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped + extension. If this namespace does not exist, it will be created. + :vartype target_namespace: str + """ + + _attribute_map = { + "target_namespace": {"key": "targetNamespace", "type": "str"}, + } + + def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ + super().__init__(**kwargs) + self.target_namespace = target_namespace + + +class ServicePrincipalDefinition(_serialization.Model): + """Parameters to authenticate using Service Principal. + + :ivar client_id: The client Id for authenticating a Service Principal. + :vartype client_id: str + :ivar tenant_id: The tenant Id for authenticating a Service Principal. + :vartype tenant_id: str + :ivar client_secret: The client secret for authenticating a Service Principal. + :vartype client_secret: str + :ivar client_certificate: Base64-encoded certificate used to authenticate a Service Principal. + :vartype client_certificate: str + :ivar client_certificate_password: The password for the certificate used to authenticate a + Service Principal. + :vartype client_certificate_password: str + :ivar client_certificate_send_chain: Specifies whether to include x5c header in client claims + when acquiring a token to enable subject name / issuer based authentication for the Client + Certificate. + :vartype client_certificate_send_chain: bool + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "client_certificate": {"key": "clientCertificate", "type": "str"}, + "client_certificate_password": {"key": "clientCertificatePassword", "type": "str"}, + "client_certificate_send_chain": {"key": "clientCertificateSendChain", "type": "bool"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + tenant_id: Optional[str] = None, + client_secret: Optional[str] = None, + client_certificate: Optional[str] = None, + client_certificate_password: Optional[str] = None, + client_certificate_send_chain: bool = False, + **kwargs: Any + ) -> None: + """ + :keyword client_id: The client Id for authenticating a Service Principal. + :paramtype client_id: str + :keyword tenant_id: The tenant Id for authenticating a Service Principal. + :paramtype tenant_id: str + :keyword client_secret: The client secret for authenticating a Service Principal. + :paramtype client_secret: str + :keyword client_certificate: Base64-encoded certificate used to authenticate a Service + Principal. + :paramtype client_certificate: str + :keyword client_certificate_password: The password for the certificate used to authenticate a + Service Principal. + :paramtype client_certificate_password: str + :keyword client_certificate_send_chain: Specifies whether to include x5c header in client + claims when acquiring a token to enable subject name / issuer based authentication for the + Client Certificate. + :paramtype client_certificate_send_chain: bool + """ + super().__init__(**kwargs) + self.client_id = client_id + self.tenant_id = tenant_id + self.client_secret = client_secret + self.client_certificate = client_certificate + self.client_certificate_password = client_certificate_password + self.client_certificate_send_chain = client_certificate_send_chain + + +class ServicePrincipalPatchDefinition(_serialization.Model): + """Parameters to authenticate using Service Principal. + + :ivar client_id: The client Id for authenticating a Service Principal. + :vartype client_id: str + :ivar tenant_id: The tenant Id for authenticating a Service Principal. + :vartype tenant_id: str + :ivar client_secret: The client secret for authenticating a Service Principal. + :vartype client_secret: str + :ivar client_certificate: Base64-encoded certificate used to authenticate a Service Principal. + :vartype client_certificate: str + :ivar client_certificate_password: The password for the certificate used to authenticate a + Service Principal. + :vartype client_certificate_password: str + :ivar client_certificate_send_chain: Specifies whether to include x5c header in client claims + when acquiring a token to enable subject name / issuer based authentication for the Client + Certificate. + :vartype client_certificate_send_chain: bool + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "client_certificate": {"key": "clientCertificate", "type": "str"}, + "client_certificate_password": {"key": "clientCertificatePassword", "type": "str"}, + "client_certificate_send_chain": {"key": "clientCertificateSendChain", "type": "bool"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + tenant_id: Optional[str] = None, + client_secret: Optional[str] = None, + client_certificate: Optional[str] = None, + client_certificate_password: Optional[str] = None, + client_certificate_send_chain: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: The client Id for authenticating a Service Principal. + :paramtype client_id: str + :keyword tenant_id: The tenant Id for authenticating a Service Principal. + :paramtype tenant_id: str + :keyword client_secret: The client secret for authenticating a Service Principal. + :paramtype client_secret: str + :keyword client_certificate: Base64-encoded certificate used to authenticate a Service + Principal. + :paramtype client_certificate: str + :keyword client_certificate_password: The password for the certificate used to authenticate a + Service Principal. + :paramtype client_certificate_password: str + :keyword client_certificate_send_chain: Specifies whether to include x5c header in client + claims when acquiring a token to enable subject name / issuer based authentication for the + Client Certificate. + :paramtype client_certificate_send_chain: bool + """ + super().__init__(**kwargs) + self.client_id = client_id + self.tenant_id = tenant_id + self.client_secret = client_secret + self.client_certificate = client_certificate + self.client_certificate_password = client_certificate_password + self.client_certificate_send_chain = client_certificate_send_chain + + +class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes + """The SourceControl Configuration object returned in Get & Put response. + + 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 system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. "Flux" + :vartype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperatorType + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Known values are: + "cluster" and "namespace". + :vartype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperatorScopeType + :ivar repository_public_key: Public Key associated with this SourceControl configuration + (either generated within the cluster or provided by the user). + :vartype repository_public_key: str + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + required to access private Git instances. + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.HelmOperatorProperties + :ivar provisioning_state: The provisioning state of the resource provider. Known values are: + "Accepted", "Deleting", "Running", "Succeeded", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ProvisioningStateType + :ivar compliance_status: Compliance Status of the Configuration. + :vartype compliance_status: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ComplianceStatus + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "repository_public_key": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "compliance_status": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "repository_url": {"key": "properties.repositoryUrl", "type": "str"}, + "operator_namespace": {"key": "properties.operatorNamespace", "type": "str"}, + "operator_instance_name": {"key": "properties.operatorInstanceName", "type": "str"}, + "operator_type": {"key": "properties.operatorType", "type": "str"}, + "operator_params": {"key": "properties.operatorParams", "type": "str"}, + "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"}, + "operator_scope": {"key": "properties.operatorScope", "type": "str"}, + "repository_public_key": {"key": "properties.repositoryPublicKey", "type": "str"}, + "ssh_known_hosts_contents": {"key": "properties.sshKnownHostsContents", "type": "str"}, + "enable_helm_operator": {"key": "properties.enableHelmOperator", "type": "bool"}, + "helm_operator_properties": {"key": "properties.helmOperatorProperties", "type": "HelmOperatorProperties"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "compliance_status": {"key": "properties.complianceStatus", "type": "ComplianceStatus"}, + } + + def __init__( + self, + *, + repository_url: Optional[str] = None, + operator_namespace: str = "default", + operator_instance_name: Optional[str] = None, + operator_type: Optional[Union[str, "_models.OperatorType"]] = None, + operator_params: Optional[str] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, + operator_scope: Union[str, "_models.OperatorScopeType"] = "cluster", + ssh_known_hosts_contents: Optional[str] = None, + enable_helm_operator: Optional[bool] = None, + helm_operator_properties: Optional["_models.HelmOperatorProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. "Flux" + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Known values are: + "cluster" and "namespace". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.HelmOperatorProperties + """ + super().__init__(**kwargs) + self.system_data = None + self.repository_url = repository_url + self.operator_namespace = operator_namespace + self.operator_instance_name = operator_instance_name + self.operator_type = operator_type + self.operator_params = operator_params + self.configuration_protected_settings = configuration_protected_settings + self.operator_scope = operator_scope + self.repository_public_key = None + self.ssh_known_hosts_contents = ssh_known_hosts_contents + self.enable_helm_operator = enable_helm_operator + self.helm_operator_properties = helm_operator_properties + self.provisioning_state = None + self.compliance_status = None + + +class SourceControlConfigurationList(_serialization.Model): + """Result of the request to list Source Control Configurations. It contains a list of + SourceControlConfiguration objects and a 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 Source Control Configurations within a Kubernetes cluster. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration] + :ivar next_link: URL to get the next set of configuration objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SourceControlConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class SubstituteFromDefinition(_serialization.Model): + """Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization. + + :ivar kind: Define whether it is ConfigMap or Secret that holds the variables to be used in + substitution. + :vartype kind: str + :ivar name: Name of the ConfigMap/Secret that holds the variables to be used in substitution. + :vartype name: str + :ivar optional: Set to True to proceed without ConfigMap/Secret, if it is not present. + :vartype optional: bool + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "optional": {"key": "optional", "type": "bool"}, + } + + def __init__( + self, *, kind: Optional[str] = None, name: Optional[str] = None, optional: bool = False, **kwargs: Any + ) -> None: + """ + :keyword kind: Define whether it is ConfigMap or Secret that holds the variables to be used in + substitution. + :paramtype kind: str + :keyword name: Name of the ConfigMap/Secret that holds the variables to be used in + substitution. + :paramtype name: str + :keyword optional: Set to True to proceed without ConfigMap/Secret, if it is not present. + :paramtype optional: bool + """ + super().__init__(**kwargs) + self.kind = kind + self.name = name + self.optional = optional + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_source_control_configuration_client_enums.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_source_control_configuration_client_enums.py new file mode 100644 index 00000000000..cf097984794 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/models/_source_control_configuration_client_enums.py @@ -0,0 +1,121 @@ +# 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 +from azure.core import CaseInsensitiveEnumMeta + + +class AKSIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The identity type.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + + +class ComplianceStateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The compliance state of the configuration.""" + + PENDING = "Pending" + COMPLIANT = "Compliant" + NONCOMPLIANT = "Noncompliant" + INSTALLED = "Installed" + FAILED = "Failed" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class FluxComplianceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Compliance state of the cluster object.""" + + COMPLIANT = "Compliant" + NON_COMPLIANT = "Non-Compliant" + PENDING = "Pending" + SUSPENDED = "Suspended" + UNKNOWN = "Unknown" + + +class KustomizationValidationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specify whether to validate the Kubernetes objects referenced in the Kustomization before + applying them to the cluster. + """ + + NONE = "none" + CLIENT = "client" + SERVER = "server" + + +class LevelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the status.""" + + ERROR = "Error" + WARNING = "Warning" + INFORMATION = "Information" + + +class MessageLevelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level of the message.""" + + ERROR = "Error" + WARNING = "Warning" + INFORMATION = "Information" + + +class OperatorScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scope at which the operator will be installed.""" + + CLUSTER = "cluster" + NAMESPACE = "namespace" + + +class OperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the operator.""" + + FLUX = "Flux" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the resource.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class ProvisioningStateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the resource provider.""" + + ACCEPTED = "Accepted" + DELETING = "Deleting" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class ScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scope at which the configuration will be installed.""" + + CLUSTER = "cluster" + NAMESPACE = "namespace" + + +class SourceKindType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Source Kind to pull the configuration data from.""" + + GIT_REPOSITORY = "GitRepository" + BUCKET = "Bucket" + AZURE_BLOB = "AzureBlob" diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/__init__.py new file mode 100644 index 00000000000..9d58b5443a0 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/__init__.py @@ -0,0 +1,29 @@ +# 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 ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._flux_configurations_operations import FluxConfigurationsOperations +from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations +from ._source_control_configurations_operations import SourceControlConfigurationsOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ExtensionsOperations", + "OperationStatusOperations", + "FluxConfigurationsOperations", + "FluxConfigOperationStatusOperations", + "SourceControlConfigurationsOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_extensions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_extensions_operations.py new file mode 100644 index 00000000000..3f8f451eeee --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_extensions_operations.py @@ -0,0 +1,1151 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + subscription_id: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_delete is not None: + _params["forceDelete"] = _SERIALIZER.query("force_delete", force_delete, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: Union[_models.Extension, IO], + **kwargs: Any + ) -> _models.Extension: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension, (IOBase, bytes)): + _content = extension + else: + _json = self._serialize.body(extension, "Extension") + + request = build_create_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: _models.Extension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Required. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Required. + :type extension: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + extension: Union[_models.Extension, IO], + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. Is either a Extension type or a + IO type. Required. + :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Extension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> _models.Extension: + """Gets Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Extension or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension + from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. Default value is None. + :type force_delete: bool + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: Union[_models.PatchExtension, IO], + **kwargs: Any + ) -> _models.Extension: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_extension, (IOBase, bytes)): + _content = patch_extension + else: + _json = self._serialize.body(patch_extension, "PatchExtension") + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("Extension", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: _models.PatchExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Required. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Required. + :type patch_extension: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + patch_extension: Union[_models.PatchExtension, IO], + **kwargs: Any + ) -> LROPoller[_models.Extension]: + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. Is either a + PatchExtension type or a IO type. Required. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 Extension or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Extension", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.Extension"]: + """List all Extensions in the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 Extension or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_config_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_config_operation_status_operations.py new file mode 100644 index 00000000000..c257b86f82e --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_config_operation_status_operations.py @@ -0,0 +1,184 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FluxConfigOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`flux_config_operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatusResult: + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_configurations_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_configurations_operations.py new file mode 100644 index 00000000000..ca22e0166a7 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_flux_configurations_operations.py @@ -0,0 +1,1162 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + subscription_id: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_delete is not None: + _params["forceDelete"] = _SERIALIZER.query("force_delete", force_delete, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FluxConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`flux_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> _models.FluxConfiguration: + """Gets details of the Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FluxConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: Union[_models.FluxConfiguration, IO], + **kwargs: Any + ) -> _models.FluxConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flux_configuration, (IOBase, bytes)): + _content = flux_configuration + else: + _json = self._serialize.body(flux_configuration, "FluxConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: _models.FluxConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required. + :type flux_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration: Union[_models.FluxConfiguration, IO], + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Create a new Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a + FluxConfiguration type or a IO type. Required. + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration=flux_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + def _update_initial( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO], + **kwargs: Any + ) -> _models.FluxConfiguration: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(flux_configuration_patch, (IOBase, bytes)): + _content = flux_configuration_patch + else: + _json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch") + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: _models.FluxConfigurationPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + Required. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. + Required. + :type flux_configuration_patch: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO], + **kwargs: Any + ) -> LROPoller[_models.FluxConfiguration]: + """Update an existing Kubernetes Flux Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is + either a FluxConfigurationPatch type or a IO type. Required. + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + flux_configuration_patch=flux_configuration_patch, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FluxConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + subscription_id=self._config.subscription_id, + force_delete=force_delete, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync + from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param flux_configuration_name: Name of the Flux Configuration. Required. + :type flux_configuration_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. Default value is None. + :type force_delete: bool + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.FluxConfiguration"]: + """List all Flux Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 FluxConfiguration or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operation_status_operations.py new file mode 100644 index 00000000000..3c72e68a958 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operation_status_operations.py @@ -0,0 +1,328 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.OperationStatusResult: + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_name: Name of the Extension. Required. + :type extension_name: str + :param operation_id: operation Id. Required. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationStatusResult or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("OperationStatusResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.OperationStatusResult"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operations.py new file mode 100644 index 00000000000..6b5589b3142 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_operations.py @@ -0,0 +1,157 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.KubernetesConfiguration/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.ResourceProviderOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"} diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_source_control_configurations_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_source_control_configurations_operations.py new file mode 100644 index 00000000000..4e7a5f177cd --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01/operations/_source_control_configurations_operations.py @@ -0,0 +1,746 @@ +# pylint: disable=too-many-lines +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "sourceControlConfigurationName": _SERIALIZER.url( + "source_control_configuration_name", source_control_configuration_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "sourceControlConfigurationName": _SERIALIZER.url( + "source_control_configuration_name", source_control_configuration_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "sourceControlConfigurationName": _SERIALIZER.url( + "source_control_configuration_name", source_control_configuration_name, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SourceControlConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01.SourceControlConfigurationClient`'s + :attr:`source_control_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Gets details of the Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: _models.SourceControlConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + Required. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. + Required. + :type source_control_configuration: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: Union[_models.SourceControlConfiguration, IO], + **kwargs: Any + ) -> _models.SourceControlConfiguration: + """Create a new Kubernetes Source Control Configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_name: str + :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is + either a SourceControlConfiguration type or a IO type. Required. + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControlConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(source_control_configuration, (IOBase, bytes)): + _content = source_control_configuration + else: + _json = self._serialize.body(source_control_configuration, "SourceControlConfiguration") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SourceControlConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """This will delete the YAML file used to set up the Source control configuration, thus stopping + future sync from the source repo. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param source_control_configuration_name: Name of the Source Control Configuration. Required. + :type source_control_configuration_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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, 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, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.SourceControlConfiguration"]: + """List all Source Control Configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 SourceControlConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/__init__.py new file mode 100644 index 00000000000..3ad4bd8b604 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/__init__.py @@ -0,0 +1,26 @@ +# 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 ._source_control_configuration_client import SourceControlConfigurationClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SourceControlConfigurationClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_configuration.py new file mode 100644 index 00000000000..0ae72980e5c --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_configuration.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SourceControlConfigurationClient. + + 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. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".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.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 = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_source_control_configuration_client.py new file mode 100644 index 00000000000..c07e272e064 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_source_control_configuration_client.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionTypesOperations, OperationStatusOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword + """KubernetesConfiguration Client. + + :ivar extension_types: ExtensionTypesOperations operations + :vartype extension_types: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.operations.ExtensionTypesOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.operations.OperationStatusOperations + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.operations.Operations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: ARMPipelineClient = 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._serialize.client_side_validation = False + self.extension_types = ExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "SourceControlConfigurationClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_vendor.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_vendor.py new file mode 100644 index 00000000000..bd0df84f531 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_vendor.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import List, cast + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_version.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_version.py new file mode 100644 index 00000000000..59deb8c7263 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.1.0" diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/__init__.py new file mode 100644 index 00000000000..b95230ae03c --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/__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 ._source_control_configuration_client import SourceControlConfigurationClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SourceControlConfigurationClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_configuration.py new file mode 100644 index 00000000000..1b9507ff31f --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_configuration.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SourceControlConfigurationClient. + + 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. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".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 = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_source_control_configuration_client.py new file mode 100644 index 00000000000..80117d110f4 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/_source_control_configuration_client.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import SourceControlConfigurationClientConfiguration +from .operations import ExtensionTypesOperations, OperationStatusOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword + """KubernetesConfiguration Client. + + :ivar extension_types: ExtensionTypesOperations operations + :vartype extension_types: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.operations.ExtensionTypesOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.operations.OperationStatusOperations + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) + self._client: AsyncARMPipelineClient = 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._serialize.client_side_validation = False + self.extension_types = ExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SourceControlConfigurationClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/__init__.py new file mode 100644 index 00000000000..dfb1afd7268 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/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 ._extension_types_operations import ExtensionTypesOperations +from ._operation_status_operations import OperationStatusOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ExtensionTypesOperations", + "OperationStatusOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_extension_types_operations.py new file mode 100644 index 00000000000..cd53a421d77 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_extension_types_operations.py @@ -0,0 +1,801 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._extension_types_operations import ( + build_cluster_get_version_request, + build_cluster_list_versions_request, + build_get_request, + build_get_version_request, + build_list_request, + build_list_versions_request, + build_location_get_request, + build_location_list_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ExtensionTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.SourceControlConfigurationClient`'s + :attr:`extension_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def location_list( + self, + location: str, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionType"]: + """List all Extension Types for the location. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_id: Filter results by Publisher ID of a marketplace extension type. Default + value is None. + :type publisher_id: str + :param offer_id: Filter results by Offer or Product ID of a marketplace extension type. Default + value is None. + :type offer_id: str + :param plan_id: Filter results by Plan ID of a marketplace extension type. Default value is + None. + :type plan_id: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param cluster_type: Filter results by the cluster type for extension types. Default value is + None. + :type cluster_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionType or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_location_list_request( + location=location, + subscription_id=self._config.subscription_id, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + release_train=release_train, + cluster_type=cluster_type, + api_version=api_version, + template_url=self.location_list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + location_list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes" + } + + @distributed_trace_async + async def location_get(self, location: str, extension_type_name: str, **kwargs: Any) -> _models.ExtensionType: + """Get an extension type for the location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionType or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None) + + request = build_location_get_request( + location=location, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.location_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionType", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + location_get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}" + } + + @distributed_trace + def list_versions( + self, + location: str, + extension_type_name: str, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionTypeVersionForReleaseTrain"]: + """List the versions for an extension type and location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param cluster_type: Filter results by the cluster type for extension types. Default value is + None. + :type cluster_type: str + :param major_version: Filter results by the major version of an extension type. Default value + is None. + :type major_version: str + :param show_latest: Filter results by only the latest version (based on other query + parameters). Default value is None. + :type show_latest: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeVersionForReleaseTrain or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_versions_request( + location=location, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + release_train=release_train, + cluster_type=cluster_type, + major_version=major_version, + show_latest=show_latest, + api_version=api_version, + template_url=self.list_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypeVersionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions" + } + + @distributed_trace_async + async def get_version( + self, location: str, extension_type_name: str, version_number: str, **kwargs: Any + ) -> _models.ExtensionTypeVersionForReleaseTrain: + """Get details of a version for an extension type and location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param version_number: Version number of the Extension Type. Required. + :type version_number: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionTypeVersionForReleaseTrain or the result of cls(response) + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionForReleaseTrain] = kwargs.pop("cls", None) + + request = build_get_version_request( + location=location, + extension_type_name=extension_type_name, + version_number=version_number, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_version.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionTypeVersionForReleaseTrain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_version.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions/{versionNumber}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionType"]: + """List installable Extension Types for the cluster based region and type for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param publisher_id: Filter results by Publisher ID of a marketplace extension type. Default + value is None. + :type publisher_id: str + :param offer_id: Filter results by Offer or Product ID of a marketplace extension type. Default + value is None. + :type offer_id: str + :param plan_id: Filter results by Plan ID of a marketplace extension type. Default value is + None. + :type plan_id: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionType or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + release_train=release_train, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> _models.ExtensionType: + """Get an Extension Type installable to the cluster based region and type for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionType or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionType", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}" + } + + @distributed_trace + def cluster_list_versions( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + release_train: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionTypeVersionForReleaseTrain"]: + """List the version for an Extension Type installable to the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param major_version: Filter results by the major version of an extension type. Default value + is None. + :type major_version: str + :param show_latest: Filter results by only the latest version (based on other query + parameters). Default value is None. + :type show_latest: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeVersionForReleaseTrain or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_cluster_list_versions_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + release_train=release_train, + major_version=major_version, + show_latest=show_latest, + api_version=api_version, + template_url=self.cluster_list_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypeVersionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + cluster_list_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions" + } + + @distributed_trace_async + async def cluster_get_version( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + version_number: str, + **kwargs: Any + ) -> _models.ExtensionTypeVersionForReleaseTrain: + """Get details of a version for an Extension Type installable to the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param version_number: Version number of the Extension Type. Required. + :type version_number: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionTypeVersionForReleaseTrain or the result of cls(response) + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionForReleaseTrain] = kwargs.pop("cls", None) + + request = build_cluster_get_version_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + version_number=version_number, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.cluster_get_version.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionTypeVersionForReleaseTrain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + cluster_get_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions/{versionNumber}" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operation_status_operations.py new file mode 100644 index 00000000000..2c6daea702b --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operation_status_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_status_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.SourceControlConfigurationClient`'s + :attr:`operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OperationStatusResult"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operations.py new file mode 100644 index 00000000000..8f833235aec --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_operations.py @@ -0,0 +1,123 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.aio.SourceControlConfigurationClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"} diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/__init__.py new file mode 100644 index 00000000000..0daf4bce06d --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/__init__.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeProperties +from ._models_py3 import ExtensionTypePropertiesPlanInfo +from ._models_py3 import ExtensionTypePropertiesSupportedScopes +from ._models_py3 import ExtensionTypeVersionForReleaseTrain +from ._models_py3 import ExtensionTypeVersionForReleaseTrainProperties +from ._models_py3 import ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions +from ._models_py3 import ExtensionTypeVersionUnsupportedKubernetesMatrixItem +from ._models_py3 import ExtensionTypeVersionsList +from ._models_py3 import ExtensionTypesList +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList + +from ._source_control_configuration_client_enums import ProvisioningState +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ClusterScopeSettings", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "ExtensionType", + "ExtensionTypeProperties", + "ExtensionTypePropertiesPlanInfo", + "ExtensionTypePropertiesSupportedScopes", + "ExtensionTypeVersionForReleaseTrain", + "ExtensionTypeVersionForReleaseTrainProperties", + "ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions", + "ExtensionTypeVersionUnsupportedKubernetesMatrixItem", + "ExtensionTypeVersionsList", + "ExtensionTypesList", + "OperationStatusList", + "OperationStatusResult", + "ProxyResource", + "Resource", + "ResourceProviderOperation", + "ResourceProviderOperationDisplay", + "ResourceProviderOperationList", + "ProvisioningState", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_models_py3.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_models_py3.py new file mode 100644 index 00000000000..707bbebb706 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_models_py3.py @@ -0,0 +1,880 @@ +# coding=utf-8 +# pylint: disable=too-many-lines +# -------------------------------------------------------------------------- +# 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, Dict, List, Optional, TYPE_CHECKING + +from ... import _serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class Resource(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = 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: Any) -> None: + """ """ + super().__init__(**kwargs) + + +class ClusterScopeSettings(ProxyResource): + """Extension scope settings. + + 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 allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: 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"}, + "allow_multiple_instances": {"key": "properties.allowMultipleInstances", "type": "bool"}, + "default_release_namespace": {"key": "properties.defaultReleaseNamespace", "type": "str"}, + } + + def __init__( + self, + *, + allow_multiple_instances: Optional[bool] = None, + default_release_namespace: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ + super().__init__(**kwargs) + self.allow_multiple_instances = allow_multiple_instances + self.default_release_namespace = default_release_namespace + + +class ErrorAdditionalInfo(_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: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_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[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_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.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExtensionType(ProxyResource): + """The Extension Type object. + + 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 properties: + :vartype properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "ExtensionTypeProperties"}, + } + + def __init__(self, *, properties: Optional["_models.ExtensionTypeProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: + :paramtype properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ExtensionTypeProperties(_serialization.Model): + """ExtensionTypeProperties. + + :ivar is_system_extension: Is this Extension Type a system extension. + :vartype is_system_extension: bool + :ivar is_managed_identity_required: Should an identity for this cluster resource be created. + :vartype is_managed_identity_required: bool + :ivar description: Description of the extension type. + :vartype description: str + :ivar publisher: Name of the publisher for the Extension Type. + :vartype publisher: str + :ivar plan_info: Plan information only for the Marketplace Extension Type. + :vartype plan_info: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypePropertiesPlanInfo + :ivar supported_cluster_types: Cluster Types supported for this Extension Type. + :vartype supported_cluster_types: list[str] + :ivar supported_scopes: Supported Kubernetes Scopes for this Extension Type. + :vartype supported_scopes: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypePropertiesSupportedScopes + """ + + _attribute_map = { + "is_system_extension": {"key": "isSystemExtension", "type": "bool"}, + "is_managed_identity_required": {"key": "isManagedIdentityRequired", "type": "bool"}, + "description": {"key": "description", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "plan_info": {"key": "planInfo", "type": "ExtensionTypePropertiesPlanInfo"}, + "supported_cluster_types": {"key": "supportedClusterTypes", "type": "[str]"}, + "supported_scopes": {"key": "supportedScopes", "type": "ExtensionTypePropertiesSupportedScopes"}, + } + + def __init__( + self, + *, + is_system_extension: Optional[bool] = None, + is_managed_identity_required: Optional[bool] = None, + description: Optional[str] = None, + publisher: Optional[str] = None, + plan_info: Optional["_models.ExtensionTypePropertiesPlanInfo"] = None, + supported_cluster_types: Optional[List[str]] = None, + supported_scopes: Optional["_models.ExtensionTypePropertiesSupportedScopes"] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_system_extension: Is this Extension Type a system extension. + :paramtype is_system_extension: bool + :keyword is_managed_identity_required: Should an identity for this cluster resource be created. + :paramtype is_managed_identity_required: bool + :keyword description: Description of the extension type. + :paramtype description: str + :keyword publisher: Name of the publisher for the Extension Type. + :paramtype publisher: str + :keyword plan_info: Plan information only for the Marketplace Extension Type. + :paramtype plan_info: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypePropertiesPlanInfo + :keyword supported_cluster_types: Cluster Types supported for this Extension Type. + :paramtype supported_cluster_types: list[str] + :keyword supported_scopes: Supported Kubernetes Scopes for this Extension Type. + :paramtype supported_scopes: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypePropertiesSupportedScopes + """ + super().__init__(**kwargs) + self.is_system_extension = is_system_extension + self.is_managed_identity_required = is_managed_identity_required + self.description = description + self.publisher = publisher + self.plan_info = plan_info + self.supported_cluster_types = supported_cluster_types + self.supported_scopes = supported_scopes + + +class ExtensionTypePropertiesPlanInfo(_serialization.Model): + """Plan information only for the Marketplace Extension Type. + + :ivar publisher_id: Publisher ID of the Marketplace Extension Type. + :vartype publisher_id: str + :ivar plan_id: Plan ID of the Marketplace Extension Type. + :vartype plan_id: str + :ivar offer_id: Offer or Product ID of the Marketplace Extension Type. + :vartype offer_id: str + """ + + _attribute_map = { + "publisher_id": {"key": "publisherId", "type": "str"}, + "plan_id": {"key": "planId", "type": "str"}, + "offer_id": {"key": "offerId", "type": "str"}, + } + + def __init__( + self, + *, + publisher_id: Optional[str] = None, + plan_id: Optional[str] = None, + offer_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher_id: Publisher ID of the Marketplace Extension Type. + :paramtype publisher_id: str + :keyword plan_id: Plan ID of the Marketplace Extension Type. + :paramtype plan_id: str + :keyword offer_id: Offer or Product ID of the Marketplace Extension Type. + :paramtype offer_id: str + """ + super().__init__(**kwargs) + self.publisher_id = publisher_id + self.plan_id = plan_id + self.offer_id = offer_id + + +class ExtensionTypePropertiesSupportedScopes(_serialization.Model): + """Supported Kubernetes Scopes for this Extension Type. + + :ivar default_scope: The default scope of the extension type. This scope will be used if the + user does not provide a scope while creating an extension. + :vartype default_scope: str + :ivar cluster_scope_settings: Extension scope settings. + :vartype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ClusterScopeSettings + """ + + _attribute_map = { + "default_scope": {"key": "defaultScope", "type": "str"}, + "cluster_scope_settings": {"key": "clusterScopeSettings", "type": "ClusterScopeSettings"}, + } + + def __init__( + self, + *, + default_scope: Optional[str] = None, + cluster_scope_settings: Optional["_models.ClusterScopeSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword default_scope: The default scope of the extension type. This scope will be used if the + user does not provide a scope while creating an extension. + :paramtype default_scope: str + :keyword cluster_scope_settings: Extension scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ClusterScopeSettings + """ + super().__init__(**kwargs) + self.default_scope = default_scope + self.cluster_scope_settings = cluster_scope_settings + + +class ExtensionTypesList(_serialization.Model): + """List Extension Types. It contains a list of ExtensionType objects and a 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 Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType] + :ivar next_link: URL to get the next set of extension type objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExtensionType]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ExtensionTypeVersionForReleaseTrain(ProxyResource): + """The Extension Type Version object. + + 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 properties: + :vartype properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrainProperties + """ + + _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"}, + "properties": {"key": "properties", "type": "ExtensionTypeVersionForReleaseTrainProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ExtensionTypeVersionForReleaseTrainProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: + :paramtype properties: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrainProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ExtensionTypeVersionForReleaseTrainProperties(_serialization.Model): + """ExtensionTypeVersionForReleaseTrainProperties. + + :ivar version: The version number for the extension type. + :vartype version: str + :ivar unsupported_kubernetes_versions: The list of supported Kubernetes cluster versions for + this extension type. + :vartype unsupported_kubernetes_versions: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions + :ivar supported_cluster_types: A list of supported cluster types for this version of the + Extension Type. + :vartype supported_cluster_types: list[str] + """ + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + "unsupported_kubernetes_versions": { + "key": "unsupportedKubernetesVersions", + "type": "ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions", + }, + "supported_cluster_types": {"key": "supportedClusterTypes", "type": "[str]"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + unsupported_kubernetes_versions: Optional[ + "_models.ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions" + ] = None, + supported_cluster_types: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: The version number for the extension type. + :paramtype version: str + :keyword unsupported_kubernetes_versions: The list of supported Kubernetes cluster versions for + this extension type. + :paramtype unsupported_kubernetes_versions: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions + :keyword supported_cluster_types: A list of supported cluster types for this version of the + Extension Type. + :paramtype supported_cluster_types: list[str] + """ + super().__init__(**kwargs) + self.version = version + self.unsupported_kubernetes_versions = unsupported_kubernetes_versions + self.supported_cluster_types = supported_cluster_types + + +class ExtensionTypeVersionForReleaseTrainPropertiesUnsupportedKubernetesVersions(_serialization.Model): + """The list of supported Kubernetes cluster versions for this extension type. + + :ivar connected_cluster: + :vartype connected_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :ivar appliances: + :vartype appliances: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :ivar provisioned_cluster: + :vartype provisioned_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :ivar managed_cluster: + :vartype managed_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + """ + + _attribute_map = { + "connected_cluster": { + "key": "connectedCluster", + "type": "[ExtensionTypeVersionUnsupportedKubernetesMatrixItem]", + }, + "appliances": {"key": "appliances", "type": "[ExtensionTypeVersionUnsupportedKubernetesMatrixItem]"}, + "provisioned_cluster": { + "key": "provisionedCluster", + "type": "[ExtensionTypeVersionUnsupportedKubernetesMatrixItem]", + }, + "managed_cluster": {"key": "managedCluster", "type": "[ExtensionTypeVersionUnsupportedKubernetesMatrixItem]"}, + } + + def __init__( + self, + *, + connected_cluster: Optional[List["_models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem"]] = None, + appliances: Optional[List["_models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem"]] = None, + provisioned_cluster: Optional[List["_models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem"]] = None, + managed_cluster: Optional[List["_models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword connected_cluster: + :paramtype connected_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :keyword appliances: + :paramtype appliances: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :keyword provisioned_cluster: + :paramtype provisioned_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + :keyword managed_cluster: + :paramtype managed_cluster: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionUnsupportedKubernetesMatrixItem] + """ + super().__init__(**kwargs) + self.connected_cluster = connected_cluster + self.appliances = appliances + self.provisioned_cluster = provisioned_cluster + self.managed_cluster = managed_cluster + + +class ExtensionTypeVersionsList(_serialization.Model): + """List Extension Type Versions. It contains a list of ExtensionTypeVersionForReleaseTrain + objects. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Extension Type Versions for an Extension Type in a Release Train. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain] + :ivar next_link: URL to get the next set of extension objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ExtensionTypeVersionForReleaseTrain]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ExtensionTypeVersionUnsupportedKubernetesMatrixItem(_serialization.Model): + """The list of Kubernetes Distribution and Versions that are not supported by this version of this + Extension Type. + + :ivar distributions: The list of Kubernetes Cluster Distribution Names not supported. + :vartype distributions: list[str] + :ivar unsupported_versions: The list of Kubernetes Versions not supported by the list of + Kubernetes Cluster Distribution names in this object. + :vartype unsupported_versions: list[str] + """ + + _attribute_map = { + "distributions": {"key": "distributions", "type": "[str]"}, + "unsupported_versions": {"key": "unsupportedVersions", "type": "[str]"}, + } + + def __init__( + self, + *, + distributions: Optional[List[str]] = None, + unsupported_versions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword distributions: The list of Kubernetes Cluster Distribution Names not supported. + :paramtype distributions: list[str] + :keyword unsupported_versions: The list of Kubernetes Versions not supported by the list of + Kubernetes Cluster Distribution names in this object. + :paramtype unsupported_versions: list[str] + """ + super().__init__(**kwargs) + self.distributions = distributions + self.unsupported_versions = unsupported_versions + + +class OperationStatusList(_serialization.Model): + """The async operations in progress, in the cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of async operations in progress, in the cluster. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.OperationStatusResult] + :ivar next_link: URL to get the next set of Operation Result objects, if any. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[OperationStatusResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(_serialization.Model): + """The current status of an async operation. + + 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 ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ErrorDetail + """ + + _validation = { + "status": {"required": True}, + "error": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Required. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = None + + +class ResourceProviderOperation(_serialization.Model): + """Supported operation of this resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperationDisplay + :ivar is_data_action: The flag that indicates whether the operation applies to data plane. + :vartype is_data_action: bool + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + _validation = { + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "origin": {"key": "origin", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.ResourceProviderOperationDisplay"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperationDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + self.is_data_action = None + self.origin = None + + +class ResourceProviderOperationDisplay(_serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(_serialization.Model): + """Result of the request to list operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by this resource provider. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperation] + :ivar next_link: URL to the next set of results, if any. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceProviderOperation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ResourceProviderOperation"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperation] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_source_control_configuration_client_enums.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_source_control_configuration_client_enums.py new file mode 100644 index 00000000000..01d288a94d6 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/models/_source_control_configuration_client_enums.py @@ -0,0 +1,21 @@ +# 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 +from azure.core import CaseInsensitiveEnumMeta + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the resource.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/__init__.py new file mode 100644 index 00000000000..dfb1afd7268 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/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 ._extension_types_operations import ExtensionTypesOperations +from ._operation_status_operations import OperationStatusOperations +from ._operations import Operations + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ExtensionTypesOperations", + "OperationStatusOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_extension_types_operations.py new file mode 100644 index 00000000000..0b7cee5195e --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_extension_types_operations.py @@ -0,0 +1,1161 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_location_list_request( + location: str, + subscription_id: str, + *, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + # Construct parameters + if publisher_id is not None: + _params["publisherId"] = _SERIALIZER.query("publisher_id", publisher_id, "str") + if offer_id is not None: + _params["offerId"] = _SERIALIZER.query("offer_id", offer_id, "str") + if plan_id is not None: + _params["planId"] = _SERIALIZER.query("plan_id", plan_id, "str") + if release_train is not None: + _params["releaseTrain"] = _SERIALIZER.query("release_train", release_train, "str") + if cluster_type is not None: + _params["clusterType"] = _SERIALIZER.query("cluster_type", cluster_type, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_location_get_request( + location: str, extension_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_versions_request( + location: str, + extension_type_name: str, + subscription_id: str, + *, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if release_train is not None: + _params["releaseTrain"] = _SERIALIZER.query("release_train", release_train, "str") + if cluster_type is not None: + _params["clusterType"] = _SERIALIZER.query("cluster_type", cluster_type, "str") + if major_version is not None: + _params["majorVersion"] = _SERIALIZER.query("major_version", major_version, "str") + if show_latest is not None: + _params["showLatest"] = _SERIALIZER.query("show_latest", show_latest, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_version_request( + location: str, extension_type_name: str, version_number: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions/{versionNumber}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + "versionNumber": _SERIALIZER.url("version_number", version_number, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + *, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url( + "cluster_resource_name", cluster_resource_name, "str", pattern=r"^[a-zA-Z]*$" + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^.*"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if publisher_id is not None: + _params["publisherId"] = _SERIALIZER.query("publisher_id", publisher_id, "str") + if offer_id is not None: + _params["offerId"] = _SERIALIZER.query("offer_id", offer_id, "str") + if plan_id is not None: + _params["planId"] = _SERIALIZER.query("plan_id", plan_id, "str") + if release_train is not None: + _params["releaseTrain"] = _SERIALIZER.query("release_train", release_train, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url( + "cluster_resource_name", cluster_resource_name, "str", pattern=r"^[a-zA-Z]*$" + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^.*"), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_list_versions_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + subscription_id: str, + *, + release_train: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url( + "cluster_resource_name", cluster_resource_name, "str", pattern=r"^[a-zA-Z]*$" + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^.*"), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if release_train is not None: + _params["releaseTrain"] = _SERIALIZER.query("release_train", release_train, "str") + if major_version is not None: + _params["majorVersion"] = _SERIALIZER.query("major_version", major_version, "str") + if show_latest is not None: + _params["showLatest"] = _SERIALIZER.query("show_latest", show_latest, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cluster_get_version_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + version_number: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions/{versionNumber}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url( + "cluster_resource_name", cluster_resource_name, "str", pattern=r"^[a-zA-Z]*$" + ), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^.*"), + "extensionTypeName": _SERIALIZER.url( + "extension_type_name", extension_type_name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-_]*$" + ), + "versionNumber": _SERIALIZER.url("version_number", version_number, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ExtensionTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.SourceControlConfigurationClient`'s + :attr:`extension_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def location_list( + self, + location: str, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ExtensionType"]: + """List all Extension Types for the location. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_id: Filter results by Publisher ID of a marketplace extension type. Default + value is None. + :type publisher_id: str + :param offer_id: Filter results by Offer or Product ID of a marketplace extension type. Default + value is None. + :type offer_id: str + :param plan_id: Filter results by Plan ID of a marketplace extension type. Default value is + None. + :type plan_id: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param cluster_type: Filter results by the cluster type for extension types. Default value is + None. + :type cluster_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionType or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_location_list_request( + location=location, + subscription_id=self._config.subscription_id, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + release_train=release_train, + cluster_type=cluster_type, + api_version=api_version, + template_url=self.location_list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + location_list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes" + } + + @distributed_trace + def location_get(self, location: str, extension_type_name: str, **kwargs: Any) -> _models.ExtensionType: + """Get an extension type for the location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionType or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None) + + request = build_location_get_request( + location=location, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.location_get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionType", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + location_get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}" + } + + @distributed_trace + def list_versions( + self, + location: str, + extension_type_name: str, + release_train: Optional[str] = None, + cluster_type: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeVersionForReleaseTrain"]: + """List the versions for an extension type and location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param cluster_type: Filter results by the cluster type for extension types. Default value is + None. + :type cluster_type: str + :param major_version: Filter results by the major version of an extension type. Default value + is None. + :type major_version: str + :param show_latest: Filter results by only the latest version (based on other query + parameters). Default value is None. + :type show_latest: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeVersionForReleaseTrain or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_versions_request( + location=location, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + release_train=release_train, + cluster_type=cluster_type, + major_version=major_version, + show_latest=show_latest, + api_version=api_version, + template_url=self.list_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypeVersionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions" + } + + @distributed_trace + def get_version( + self, location: str, extension_type_name: str, version_number: str, **kwargs: Any + ) -> _models.ExtensionTypeVersionForReleaseTrain: + """Get details of a version for an extension type and location. + + :param location: The name of Azure region. Required. + :type location: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param version_number: Version number of the Extension Type. Required. + :type version_number: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionTypeVersionForReleaseTrain or the result of cls(response) + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionForReleaseTrain] = kwargs.pop("cls", None) + + request = build_get_version_request( + location=location, + extension_type_name=extension_type_name, + version_number=version_number, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_version.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionTypeVersionForReleaseTrain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_version.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions/{versionNumber}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + publisher_id: Optional[str] = None, + offer_id: Optional[str] = None, + plan_id: Optional[str] = None, + release_train: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ExtensionType"]: + """List installable Extension Types for the cluster based region and type for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param publisher_id: Filter results by Publisher ID of a marketplace extension type. Default + value is None. + :type publisher_id: str + :param offer_id: Filter results by Offer or Product ID of a marketplace extension type. Default + value is None. + :type offer_id: str + :param plan_id: Filter results by Plan ID of a marketplace extension type. Default value is + None. + :type plan_id: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionType or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + publisher_id=publisher_id, + offer_id=offer_id, + plan_id=plan_id, + release_train=release_train, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> _models.ExtensionType: + """Get an Extension Type installable to the cluster based region and type for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionType or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionType + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionType", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}" + } + + @distributed_trace + def cluster_list_versions( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + release_train: Optional[str] = None, + major_version: Optional[str] = None, + show_latest: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeVersionForReleaseTrain"]: + """List the version for an Extension Type installable to the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param release_train: Filter results by release train (default value is stable). Default value + is None. + :type release_train: str + :param major_version: Filter results by the major version of an extension type. Default value + is None. + :type major_version: str + :param show_latest: Filter results by only the latest version (based on other query + parameters). Default value is None. + :type show_latest: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeVersionForReleaseTrain or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionsList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_cluster_list_versions_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + subscription_id=self._config.subscription_id, + release_train=release_train, + major_version=major_version, + show_latest=show_latest, + api_version=api_version, + template_url=self.cluster_list_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ExtensionTypeVersionsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + cluster_list_versions.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions" + } + + @distributed_trace + def cluster_get_version( + self, + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + extension_type_name: str, + version_number: str, + **kwargs: Any + ) -> _models.ExtensionTypeVersionForReleaseTrain: + """Get details of a version for an Extension Type installable to the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters, appliances. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :type cluster_name: str + :param extension_type_name: Name of the Extension Type. Required. + :type extension_type_name: str + :param version_number: Version number of the Extension Type. Required. + :type version_number: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtensionTypeVersionForReleaseTrain or the result of cls(response) + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ExtensionTypeVersionForReleaseTrain + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01-preview")) + cls: ClsType[_models.ExtensionTypeVersionForReleaseTrain] = kwargs.pop("cls", None) + + request = build_cluster_get_version_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + version_number=version_number, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.cluster_get_version.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ExtensionTypeVersionForReleaseTrain", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + cluster_get_version.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}/versions/{versionNumber}" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operation_status_operations.py new file mode 100644 index 00000000000..d38d8d29c49 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operation_status_operations.py @@ -0,0 +1,186 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + cluster_rp: str, + cluster_resource_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.SourceControlConfigurationClient`'s + :attr:`operation_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.OperationStatusResult"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, + Microsoft.Kubernetes, Microsoft.HybridContainerService. Required. + :type cluster_rp: str + :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters, + connectedClusters, provisionedClusters. Required. + :type cluster_resource_name: str + :param cluster_name: The name of the kubernetes cluster. Required. + :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 OperationStatusResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationStatusList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations" + } diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operations.py new file mode 100644 index 00000000000..0f7d5f9d36c --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_operations.py @@ -0,0 +1,145 @@ +# pylint: disable=too-many-lines +# 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, Iterable, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.KubernetesConfiguration/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.SourceControlConfigurationClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: + """List all the available operations the KubernetesConfiguration resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01_preview.models.ResourceProviderOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"} diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_patch.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/src/k8s-extension/setup.py b/src/k8s-extension/setup.py index 372e95cbb29..9a2482f191a 100644 --- a/src/k8s-extension/setup.py +++ b/src/k8s-extension/setup.py @@ -33,7 +33,7 @@ # TODO: Add any additional SDK dependencies here DEPENDENCIES = [] -VERSION = "1.4.5" +VERSION = "1.5.0" with open("README.rst", "r", encoding="utf-8") as f: README = f.read()