diff --git a/src/k8s-extension/HISTORY.rst b/src/k8s-extension/HISTORY.rst index 117967b4c23..f9012d4007f 100644 --- a/src/k8s-extension/HISTORY.rst +++ b/src/k8s-extension/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +1.0.0 +++++++++++++++++++ +* Switch to GA api-version of Extensions (2021-09-01) +* Support Extensions PATCH +* Enable Dapr extension type +* Enable ManagedClusters clusterType + 0.7.1 ++++++++++++++++++ * Fix DF resource manager endpoint check diff --git a/src/k8s-extension/README.rst b/src/k8s-extension/README.rst index 9cc688f8f27..6f51a26fd9f 100644 --- a/src/k8s-extension/README.rst +++ b/src/k8s-extension/README.rst @@ -56,4 +56,18 @@ az k8s-extension list \ --cluster-type clusterType ``` -If you have issues, please give feedback by opening an issue at https://github.com/Azure/azure-cli-extensions/issues. +##### Update an existing KubernetesExtension of a cluster +``` +az k8s-extension update \ + --resource-group groupName \ + --cluster-name clusterName \ + --cluster-type clusterType \ + --name extensionName \ + --auto-upgrade true/false \ + --version extensionVersion \ + --release-train releaseTrain \ + --configuration-settings settingsKey=settingsValue \ + --configuration-protected-settings protectedSettingsKey=protectedValue \ + --configuration-settings-file configSettingsFile \ + --configuration-protected-settings-file protectedSettingsFile +``` diff --git a/src/k8s-extension/azext_k8s_extension/_format.py b/src/k8s-extension/azext_k8s_extension/_format.py index ef96f7cf88f..5920f5380a7 100644 --- a/src/k8s-extension/azext_k8s_extension/_format.py +++ b/src/k8s-extension/azext_k8s_extension/_format.py @@ -17,8 +17,8 @@ def k8s_extension_show_table_format(result): def __get_table_row(result): return OrderedDict([ ('name', result['name']), - ('extensionType', result['extensionType']), - ('version', result['version']), - ('installState', result['installState']), - ('lastModifiedTime', result['lastModifiedTime']) + ('extensionType', result.get('extensionType', '')), + ('version', result.get('version', '')), + ('provisioningState', result.get('provisioningState', '')), + ('lastModifiedAt', result.get('systemData', {}).get('lastModifiedAt', '')), ]) diff --git a/src/k8s-extension/azext_k8s_extension/_help.py b/src/k8s-extension/azext_k8s_extension/_help.py index 23601420648..2f2ed72945b 100644 --- a/src/k8s-extension/azext_k8s_extension/_help.py +++ b/src/k8s-extension/azext_k8s_extension/_help.py @@ -19,10 +19,9 @@ examples: - name: Create a Kubernetes Extension text: |- - az {consts.EXTENSION_NAME} create --resource-group my-resource-group \\ - --cluster-name mycluster --cluster-type connectedClusters \\ - --name myextension --extension-type microsoft.openservicemesh \\ - --scope cluster --release-train stable + az {consts.EXTENSION_NAME} create --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --name myextension \ +--extension-type microsoft.openservicemesh --scope cluster --release-train stable """ helps[f'{consts.EXTENSION_NAME} list'] = f""" @@ -31,8 +30,8 @@ examples: - name: List all Kubernetes Extensions on a cluster text: |- - az {consts.EXTENSION_NAME} list --resource-group my-resource-group \\ - --cluster-name mycluster --cluster-type connectedClusters + az {consts.EXTENSION_NAME} list --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters """ helps[f'{consts.EXTENSION_NAME} delete'] = f""" @@ -41,8 +40,8 @@ examples: - name: Delete an existing Kubernetes Extension text: |- - az {consts.EXTENSION_NAME} delete --resource-group my-resource-group \\ - --cluster-name mycluster --cluster-type connectedClusters --name myextension + az {consts.EXTENSION_NAME} delete --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --name myextension """ helps[f'{consts.EXTENSION_NAME} show'] = f""" @@ -51,6 +50,24 @@ examples: - name: Show details of a Kubernetes Extension text: |- - az {consts.EXTENSION_NAME} show --resource-group my-resource-group \\ - --cluster-name mycluster --cluster-type connectedClusters --name myextension + az {consts.EXTENSION_NAME} show --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters --name myextension +""" + +helps[f'{consts.EXTENSION_NAME} update'] = f""" + type: command + short-summary: Update mutable properties of a Kubernetes Extension. + long-summary: For update to ConfigSettings and ConfigProtectedSettings, please \ +refer to documentation of the cluster extension service to check update to these \ +properties is supported before updating these properties. + examples: + - name: Update a Kubernetes Extension + text: |- + az {consts.EXTENSION_NAME} update --resource-group my-resource-group \ +--cluster-name mycluster --cluster-type connectedClusters \ +--name myextension --auto-upgrade true/false --version extension-version \ +--release-train stable --configuration-settings settings-key=settings-value \ +--configuration-protected-settings protected-settings-key=protected-value \ +--configuration-settings-file=config-settings-file \ +--configuration-protected-settings-file=protected-settings-file """ diff --git a/src/k8s-extension/azext_k8s_extension/_params.py b/src/k8s-extension/azext_k8s_extension/_params.py index 58b252e7a16..7981cd8bffe 100644 --- a/src/k8s-extension/azext_k8s_extension/_params.py +++ b/src/k8s-extension/azext_k8s_extension/_params.py @@ -5,8 +5,7 @@ from azure.cli.core.commands.parameters import ( get_enum_type, - get_three_state_flag, - tags_type + get_three_state_flag ) from azure.cli.core.commands.validators import get_default_location_from_resource_group from . import consts @@ -19,7 +18,6 @@ def load_arguments(self, _): with self.argument_context(consts.EXTENSION_NAME) as c: - c.argument('tags', tags_type) c.argument('location', validator=get_default_location_from_resource_group) c.argument('name', @@ -75,7 +73,14 @@ def load_arguments(self, _): help='Specify the target namespace to install to for the extension instance. This' ' parameter is required if extension scope is set to \'namespace\'') + with self.argument_context(f"{consts.EXTENSION_NAME} update") as c: + c.argument('yes', + options_list=['--yes', '-y'], + help='Ignore confirmation prompts') + with self.argument_context(f"{consts.EXTENSION_NAME} delete") as c: c.argument('yes', options_list=['--yes', '-y'], help='Ignore confirmation prompts') + c.argument('force', + help='Specify whether to force delete the extension from the cluster.') diff --git a/src/k8s-extension/azext_k8s_extension/azext_metadata.json b/src/k8s-extension/azext_k8s_extension/azext_metadata.json index f5fcee1c14a..53610435cef 100644 --- a/src/k8s-extension/azext_k8s_extension/azext_metadata.json +++ b/src/k8s-extension/azext_k8s_extension/azext_metadata.json @@ -1,4 +1,3 @@ { - "azext.isPreview": true, "azext.minCliCoreVersion": "2.24.0" } diff --git a/src/k8s-extension/azext_k8s_extension/commands.py b/src/k8s-extension/azext_k8s_extension/commands.py index 96875ee06df..5c01b393e9d 100644 --- a/src/k8s-extension/azext_k8s_extension/commands.py +++ b/src/k8s-extension/azext_k8s_extension/commands.py @@ -16,10 +16,10 @@ def load_command_table(self, _): operations_tmpl=consts.EXTENSION_PACKAGE_NAME + '.vendored_sdks.operations#K8sExtensionsOperations.{}', client_factory=cf_k8s_extension) - with self.command_group(consts.EXTENSION_NAME, k8s_extension_sdk, client_factory=cf_k8s_extension_operation, - is_preview=True) \ + with self.command_group(consts.EXTENSION_NAME, k8s_extension_sdk, client_factory=cf_k8s_extension_operation) \ as g: - g.custom_command('create', 'create_k8s_extension') - g.custom_command('delete', 'delete_k8s_extension') + g.custom_command('create', 'create_k8s_extension', supports_no_wait=True) + g.custom_command('delete', 'delete_k8s_extension', supports_no_wait=True) g.custom_command('list', 'list_k8s_extension', table_transformer=k8s_extension_list_table_format) g.custom_show_command('show', 'show_k8s_extension', table_transformer=k8s_extension_show_table_format) + g.custom_command('update', 'update_k8s_extension', supports_no_wait=True) diff --git a/src/k8s-extension/azext_k8s_extension/custom.py b/src/k8s-extension/azext_k8s_extension/custom.py index 4a5985bb1b3..f51b1a26c89 100644 --- a/src/k8s-extension/azext_k8s_extension/custom.py +++ b/src/k8s-extension/azext_k8s_extension/custom.py @@ -6,21 +6,23 @@ # pylint: disable=unused-argument,too-many-locals import json -from knack.log import get_logger from urllib.parse import urlparse +from knack.log import get_logger from azure.cli.core.azclierror import ResourceNotFoundError, MutuallyExclusiveArgumentError, \ - InvalidArgumentValueError, CommandNotFoundError, RequiredArgumentMissingError + InvalidArgumentValueError, RequiredArgumentMissingError from azure.cli.core.commands.client_factory import get_subscription_id +from azure.cli.core.util import sdk_no_wait from azure.core.exceptions import HttpResponseError -from .vendored_sdks.models import ConfigurationIdentity, Scope +from .vendored_sdks.models import Identity, Scope from ._validators import validate_cc_registration from .partner_extensions.ContainerInsights import ContainerInsights from .partner_extensions.AzureDefender import AzureDefender -from .partner_extensions.AzureMLKubernetes import AzureMLKubernetes from .partner_extensions.OpenServiceMesh import OpenServiceMesh -from .partner_extensions.DefaultExtension import DefaultExtension +from .partner_extensions.AzureMLKubernetes import AzureMLKubernetes +from .partner_extensions.Dapr import Dapr +from .partner_extensions.DefaultExtension import DefaultExtension, user_confirmation_factory from . import consts from ._client_factory import cf_resources @@ -35,6 +37,7 @@ def ExtensionFactory(extension_name): 'microsoft.azuredefender.kubernetes': AzureDefender, 'microsoft.openservicemesh': OpenServiceMesh, 'microsoft.azureml.kubernetes': AzureMLKubernetes, + 'microsoft.dapr': Dapr, } # Return the extension if we find it in the map, else return the default @@ -43,7 +46,6 @@ def ExtensionFactory(extension_name): def show_k8s_extension(client, resource_group_name, cluster_name, name, cluster_type): """Get an existing K8s Extension. - """ # Determine ClusterRP cluster_rp = __get_cluster_rp(cluster_type) @@ -74,9 +76,8 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c extension_type, scope=None, auto_upgrade_minor_version=None, release_train=None, version=None, target_namespace=None, release_namespace=None, configuration_settings=None, configuration_protected_settings=None, configuration_settings_file=None, - configuration_protected_settings_file=None, tags=None): + configuration_protected_settings_file=None, no_wait=False): """Create a new Extension Instance. - """ extension_type_lower = extension_type.lower() @@ -140,11 +141,13 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c # Create identity, if required # We don't create the identity if we are in DF if create_identity and not is_dogfood_cluster(cmd): - extension_instance.identity, extension_instance.location = \ - __create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp) + identity_object, location = __create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp) + if identity_object is not None and location is not None: + extension_instance.identity, extension_instance.location = identity_object, location # Try to create the resource - return client.create(resource_group_name, cluster_rp, cluster_type, cluster_name, name, extension_instance) + return sdk_no_wait(no_wait, client.begin_create, resource_group_name, + cluster_rp, cluster_type, cluster_name, name, extension_instance) def list_k8s_extension(client, resource_group_name, cluster_name, cluster_type): @@ -152,48 +155,64 @@ def list_k8s_extension(client, resource_group_name, cluster_name, cluster_type): return client.list(resource_group_name, cluster_rp, cluster_type, cluster_name) -def update_k8s_extension(client, resource_group_name, cluster_type, cluster_name, name, - auto_upgrade_minor_version='', release_train='', version='', tags=None): - +def update_k8s_extension(cmd, client, resource_group_name, cluster_name, name, cluster_type, + auto_upgrade_minor_version='', release_train='', version='', + configuration_settings=None, configuration_protected_settings=None, + configuration_settings_file=None, configuration_protected_settings_file=None, + no_wait=False, yes=False): """Patch an existing Extension Instance. - """ - # TODO: Remove this after we eventually get PATCH implemented for update and uncomment - raise CommandNotFoundError( - f"\"{consts.EXTENSION_NAME} update\" currently is not available. " - f"Use \"{consts.EXTENSION_NAME} create\" to update a previously created extension instance." - ) + if configuration_settings or \ + configuration_protected_settings or \ + configuration_settings_file or \ + configuration_protected_settings_file: + msg = ('Updating properties in --config-settings or --config-protected-settings may lead to undesirable state' + ' if the cluster extension type does not support it. Please refer to the documentation of the' + ' cluster extension service to check if updates to these properties is supported.' + ' Do you wish to proceed?') + user_confirmation_factory(cmd, yes, msg) - # # Ensure some values are provided for update - # if auto_upgrade_minor_version is None and release_train is None and version is None: - # message = "Error! No values provided for update. Provide new value(s) for one or more of these properties:" \ - # " auto-upgrade-minor-version, release-train or version." - # raise RequiredArgumentMissingError(message) + # Determine ClusterRP + cluster_rp = __get_cluster_rp(cluster_type) - # # Determine ClusterRP - # cluster_rp = __get_cluster_rp(cluster_type) + # We need to determine the ExtensionType to call ExtensionFactory and create Extension class + extension = show_k8s_extension(client, resource_group_name, cluster_name, name, cluster_type) + extension_type_lower = extension.extension_type.lower() - # # Get the existing extensionInstance - # extension = client.get(resource_group_name, cluster_rp, cluster_type, cluster_name, name) + config_settings = {} + config_protected_settings = {} + # Get Configuration Settings from file + if configuration_settings_file is not None: + config_settings = __read_config_settings_file(configuration_settings_file) - # extension_type_lower = extension.extension_type.lower() + if configuration_settings is not None: + for dicts in configuration_settings: + for key, value in dicts.items(): + config_settings[key] = value + + # Get Configuration Protected Settings from file + if configuration_protected_settings_file is not None: + config_protected_settings = __read_config_settings_file(configuration_protected_settings_file) - # # Get the extension class based on the extension name - # extension_class = ExtensionFactory(extension_type_lower) - # upd_extension = extension_class.Update(extension, auto_upgrade_minor_version, release_train, version) + if configuration_protected_settings is not None: + for dicts in configuration_protected_settings: + for key, value in dicts.items(): + config_protected_settings[key] = value - # __validate_version_and_auto_upgrade(version, auto_upgrade_minor_version) + # Get the extension class based on the extension type + extension_class = ExtensionFactory(extension_type_lower) - # upd_extension = ExtensionInstanceUpdate(auto_upgrade_minor_version=auto_upgrade_minor_version, - # release_train=release_train, version=version) + upd_extension = extension_class.Update(auto_upgrade_minor_version, release_train, version, + config_settings, config_protected_settings) - # return client.update(resource_group_name, cluster_rp, cluster_type, cluster_name, name, upd_extension) + return sdk_no_wait(no_wait, client.begin_update, resource_group_name, cluster_rp, cluster_type, + cluster_name, name, upd_extension) -def delete_k8s_extension(cmd, client, resource_group_name, cluster_name, name, cluster_type, yes=False): +def delete_k8s_extension(cmd, client, resource_group_name, cluster_name, name, cluster_type, + no_wait=False, yes=False, force=False): """Delete an existing Kubernetes Extension. - """ # Determine ClusterRP cluster_rp = __get_cluster_rp(cluster_type) @@ -206,9 +225,11 @@ def delete_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c extension_class = ExtensionFactory(extension.extension_type.lower()) # If there is any custom delete logic, this will call the logic - extension_class.Delete(cmd, client, resource_group_name, cluster_name, name, cluster_type, yes) + extension_class.Delete(cmd, client, resource_group_name, cluster_name, + name, cluster_type, yes) - return client.delete(resource_group_name, cluster_rp, cluster_type, cluster_name, name) + return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, + cluster_rp, cluster_type, cluster_name, name, force_delete=force) def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp): @@ -226,7 +247,7 @@ def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, clus elif cluster_rp == 'Microsoft.ResourceConnector': parent_api_version = '2020-09-15-privatepreview' elif cluster_rp == 'Microsoft.ContainerService': - parent_api_version = '2017-07-01' + return None, None else: raise InvalidArgumentValueError( "Error! Cluster type '{}' is not supported for extension identity".format(cluster_type) @@ -239,7 +260,7 @@ def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, clus raise ex identity_type = "SystemAssigned" - return ConfigurationIdentity(type=identity_type), location + return Identity(type=identity_type), location def __get_cluster_rp(cluster_type): @@ -248,7 +269,7 @@ def __get_cluster_rp(cluster_type): rp = 'Microsoft.Kubernetes' elif cluster_type.lower() == 'appliances': rp = 'Microsoft.ResourceConnector' - elif cluster_type.lower() == '': + elif cluster_type.lower() == '' or cluster_type.lower() == 'managedclusters': rp = 'Microsoft.ContainerService' else: raise InvalidArgumentValueError("Error! Cluster type '{}' is not supported".format(cluster_type)) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureDefender.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureDefender.py index b8da6a293b6..4dce31b9764 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureDefender.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureDefender.py @@ -7,7 +7,7 @@ from knack.log import get_logger -from ..vendored_sdks.models import ExtensionInstance +from ..vendored_sdks.models import Extension from ..vendored_sdks.models import ScopeCluster from ..vendored_sdks.models import Scope @@ -24,13 +24,13 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t configuration_settings_file, configuration_protected_settings_file): """ExtensionType 'microsoft.azuredefender.kubernetes' specific validations & defaults for Create - Must create and return a valid 'ExtensionInstance' object. + Must create and return a valid 'Extension' object. """ # NOTE-1: Replace default scope creation with your customization! ext_scope = None # Hardcoding name, release_namespace and scope since ci only supports one instance and cluster scope - # and platform doesnt have support yet extension specific constraints like this + # and platform doesn't have support yet extension specific constraints like this name = extension_type.lower() release_namespace = "azuredefender" # Scope is always cluster @@ -46,9 +46,9 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t _get_container_insights_settings(cmd, resource_group_name, cluster_name, configuration_settings, configuration_protected_settings, is_ci_extension_type) - # NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity + # NOTE-2: Return a valid Extension object, Instance name and flag for Identity create_identity = True - extension_instance = ExtensionInstance( + extension_instance = Extension( extension_type=extension_type, auto_upgrade_minor_version=auto_upgrade_minor_version, release_train=release_train, diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py index c85b88c943b..d6de36bb246 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -10,7 +10,6 @@ import copy from hashlib import md5 from typing import Any, Dict, List, Tuple -from azext_k8s_extension.partner_extensions.DefaultExtension import DefaultExtension import azure.mgmt.relay import azure.mgmt.relay.models @@ -30,7 +29,7 @@ from .._client_factory import cf_resources from .DefaultExtension import DefaultExtension, user_confirmation_factory from ..vendored_sdks.models import ( - ExtensionInstance, + Extension, Scope, ScopeCluster ) @@ -145,7 +144,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t release_train = 'stable' create_identity = True - extension_instance = ExtensionInstance( + extension = Extension( extension_type=extension_type, auto_upgrade_minor_version=auto_upgrade_minor_version, release_train=release_train, @@ -156,7 +155,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t identity=None, location="" ) - return extension_instance, name, create_identity + return extension, name, create_identity def Delete(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, yes): # Give a warning message @@ -190,7 +189,7 @@ def __validate_config(self, configuration_settings, configuration_protected_sett self.__set_up_inference_ssl(configuration_settings, configuration_protected_settings) elif not (enable_training or enable_inference): raise InvalidArgumentValueError( - "Please create Microsoft.AzureML.Kubernetes extension instance either " + "Please create Microsoft.AzureML.Kubernetes extension, either " "for Machine Learning training or inference by specifying " f"'--configuration-settings {self.ENABLE_TRAINING}=true' or '--configuration-settings {self.ENABLE_INFERENCE}=true'") @@ -478,9 +477,9 @@ def _get_cluster_rp_api_version(cluster_type) -> Tuple[str, str]: elif cluster_type.lower() == 'appliances': rp = 'Microsoft.ResourceConnector' parent_api_version = '2020-09-15-privatepreview' - elif cluster_type.lower() == '': + elif cluster_type.lower() == '' or cluster_type.lower() == 'managedclusters': rp = 'Microsoft.ContainerService' - parent_api_version = '2017-07-01' + parent_api_version = '2021-05-01' else: raise InvalidArgumentValueError("Error! Cluster type '{}' is not supported".format(cluster_type)) return rp, parent_api_version diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py index 3d4663ace14..f152b2e2ca8 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py @@ -16,7 +16,7 @@ from azure.cli.core.util import sdk_no_wait from msrestazure.tools import parse_resource_id, is_valid_resource_id -from ..vendored_sdks.models import ExtensionInstance +from ..vendored_sdks.models import Extension from ..vendored_sdks.models import ScopeCluster from ..vendored_sdks.models import Scope @@ -35,7 +35,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t configuration_settings_file, configuration_protected_settings_file): """ExtensionType 'microsoft.azuremonitor.containers' specific validations & defaults for Create - Must create and return a valid 'ExtensionInstance' object. + Must create and return a valid 'Extension' object. """ # NOTE-1: Replace default scope creation with your customization! @@ -57,9 +57,9 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t _get_container_insights_settings(cmd, resource_group_name, cluster_name, configuration_settings, configuration_protected_settings, is_ci_extension_type) - # NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity + # NOTE-2: Return a valid Extension object, Instance name and flag for Identity create_identity = True - extension_instance = ExtensionInstance( + extension = Extension( extension_type=extension_type, auto_upgrade_minor_version=auto_upgrade_minor_version, release_train=release_train, @@ -68,7 +68,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t configuration_settings=configuration_settings, configuration_protected_settings=configuration_protected_settings ) - return extension_instance, name, create_identity + return extension, name, create_identity # Custom Validation Logic for Container Insights diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py new file mode 100644 index 00000000000..484c1f23d4a --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=unused-argument +# pylint: disable=line-too-long +# pylint: disable=too-many-locals + +from .DefaultExtension import DefaultExtension + +from ..vendored_sdks.models import ( + Extension, +) + + +class Dapr(DefaultExtension): + def __init__(self): + # constants for configuration settings. + self.CLUSTER_TYPE = 'global.clusterType' + + def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, extension_type, + scope, auto_upgrade_minor_version, release_train, version, target_namespace, + release_namespace, configuration_settings, configuration_protected_settings, + configuration_settings_file, configuration_protected_settings_file): + + """ExtensionType 'Microsoft.Dapr' specific validations & defaults for Create + Must create and return a valid 'ExtensionInstance' object. + """ + + if cluster_type.lower() == '' or cluster_type.lower() == 'managedclusters': + configuration_settings[self.CLUSTER_TYPE] = 'managedclusters' + + create_identity = False + extension_instance = Extension( + extension_type=extension_type, + auto_upgrade_minor_version=auto_upgrade_minor_version, + release_train=release_train, + version=version, + scope=scope, + configuration_settings=configuration_settings, + configuration_protected_settings=configuration_protected_settings, + identity=None, + location="" + ) + return extension_instance, name, create_identity diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/DefaultExtension.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/DefaultExtension.py index 0adec037a8f..e38f0d6e37c 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/DefaultExtension.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/DefaultExtension.py @@ -7,8 +7,8 @@ from azure.cli.core.util import user_confirmation -from ..vendored_sdks.models import ExtensionInstance -from ..vendored_sdks.models import ExtensionInstanceUpdate +from ..vendored_sdks.models import Extension +from ..vendored_sdks.models import PatchExtension from ..vendored_sdks.models import ScopeCluster from ..vendored_sdks.models import ScopeNamespace from ..vendored_sdks.models import Scope @@ -21,10 +21,8 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t scope, auto_upgrade_minor_version, release_train, version, target_namespace, release_namespace, configuration_settings, configuration_protected_settings, configuration_settings_file, configuration_protected_settings_file): - """Default validations & defaults for Create - Must create and return a valid 'ExtensionInstance' object. - + Must create and return a valid 'Extension' object. """ ext_scope = None if scope is not None: @@ -36,7 +34,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t ext_scope = Scope(namespace=scope_namespace, cluster=None) create_identity = True - extension_instance = ExtensionInstance( + extension = Extension( extension_type=extension_type, auto_upgrade_minor_version=auto_upgrade_minor_version, release_train=release_train, @@ -45,18 +43,19 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t configuration_settings=configuration_settings, configuration_protected_settings=configuration_protected_settings ) - return extension_instance, name, create_identity + return extension, name, create_identity - def Update(self, extension, auto_upgrade_minor_version, release_train, version): + def Update(self, auto_upgrade_minor_version, release_train, version, configuration_settings, + configuration_protected_settings): """Default validations & defaults for Update - Must create and return a valid 'ExtensionInstanceUpdate' object. - + Must create and return a valid 'PatchExtension' object. """ - return ExtensionInstanceUpdate( - auto_upgrade_minor_version=auto_upgrade_minor_version, - release_train=release_train, - version=version - ) + + return PatchExtension(auto_upgrade_minor_version=auto_upgrade_minor_version, + release_train=release_train, + version=version, + configuration_settings=configuration_settings, + configuration_protected_settings=configuration_protected_settings) def Delete(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, yes): user_confirmation_factory(cmd, yes) 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 8480d155b05..9af8a12ccb2 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/OpenServiceMesh.py @@ -7,7 +7,6 @@ # pylint: disable=redefined-outer-name # pylint: disable=no-member -from azext_k8s_extension.partner_extensions.DefaultExtension import DefaultExtension from knack.log import get_logger from azure.cli.core.azclierror import InvalidArgumentValueError @@ -20,8 +19,7 @@ from .DefaultExtension import DefaultExtension from ..vendored_sdks.models import ( - ExtensionInstance, - ExtensionInstanceUpdate, + Extension, ScopeCluster, Scope ) @@ -37,10 +35,8 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t scope, auto_upgrade_minor_version, release_train, version, target_namespace, release_namespace, configuration_settings, configuration_protected_settings, configuration_settings_file, configuration_protected_settings_file): - """ExtensionType 'microsoft.openservicemesh' specific validations & defaults for Create - Must create and return a valid 'ExtensionInstance' object. - + Must create and return a valid 'Extension' object. """ # NOTE-1: Replace default scope creation with your customization, if required # Scope must always be cluster @@ -52,12 +48,12 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t scope_cluster = ScopeCluster(release_namespace=release_namespace) ext_scope = Scope(cluster=scope_cluster, namespace=None) - # NOTE-2: Return a valid ExtensionInstance object, Instance name and flag for Identity + # NOTE-2: Return a valid Extension object, Instance name and flag for Identity create_identity = False _validate_tested_distro(cmd, resource_group_name, cluster_name, version) - extension_instance = ExtensionInstance( + extension = Extension( extension_type=extension_type, auto_upgrade_minor_version=auto_upgrade_minor_version, release_train=release_train, @@ -68,26 +64,7 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t identity=None, location="" ) - return extension_instance, name, create_identity - - def Update(self, extension, auto_upgrade_minor_version, release_train, version): - """ExtensionType 'microsoft.openservicemesh' specific validations & defaults for Update - Must create and return a valid 'ExtensionInstanceUpdate' object. - - """ - # auto-upgrade-minor-version MUST be set to False if release_train is staging or pilot - if release_train.lower() in ['staging', 'pilot']: - if auto_upgrade_minor_version or auto_upgrade_minor_version is None: - auto_upgrade_minor_version = False - # Set version to None to always get the latest version - user cannot override - version = None - logger.warning("Setting auto-upgrade-minor-version to False since release-train is '%s'", release_train) - - return ExtensionInstanceUpdate( - auto_upgrade_minor_version=auto_upgrade_minor_version, - release_train=release_train, - version=version - ) + return extension, name, create_identity def _validate_tested_distro(cmd, cluster_resource_group_name, cluster_name, extension_version): @@ -95,6 +72,7 @@ def _validate_tested_distro(cmd, cluster_resource_group_name, cluster_name, exte field_unavailable_error = '\"testedDistros\" field unavailable for version {0} of microsoft.openservicemesh, ' \ 'cannot determine if this Kubernetes distribution has been properly tested'.format(extension_version) + logger.debug('Input version: %s', version) if version.parse(str(extension_version)) <= version.parse("0.8.3"): logger.warning(field_unavailable_error) return diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/PartnerExtensionModel.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/PartnerExtensionModel.py index 8e89bfa15fc..0e56c203a91 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/PartnerExtensionModel.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/PartnerExtensionModel.py @@ -4,8 +4,8 @@ # -------------------------------------------------------------------------------------------- from abc import ABC, abstractmethod -from ..vendored_sdks.models import ExtensionInstance -from ..vendored_sdks.models import ExtensionInstanceUpdate +from ..vendored_sdks.models import Extension +from ..vendored_sdks.models import PatchExtension class PartnerExtensionModel(ABC): @@ -14,12 +14,12 @@ def Create(self, cmd, client, resource_group_name: str, cluster_name: str, name: extension_type: str, scope: str, auto_upgrade_minor_version: bool, release_train: str, version: str, target_namespace: str, release_namespace: str, configuration_settings: dict, configuration_protected_settings: dict, configuration_settings_file: str, - configuration_protected_settings_file: str) -> ExtensionInstance: + configuration_protected_settings_file: str) -> Extension: pass @abstractmethod - def Update(self, extension: ExtensionInstance, auto_upgrade_minor_version: bool, - release_train: str, version: str) -> ExtensionInstanceUpdate: + def Update(self, auto_upgrade_minor_version: bool, release_train: str, version: str, + configuration_settings: dict, configuration_protected_settings: dict) -> PatchExtension: pass @abstractmethod 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 c55ebb0a737..58b172218ec 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 @@ -13,28 +13,158 @@ interactions: ParameterSetName: - -g -n -c --cluster-type --extension-type --release-train --version User-Agent: - - AZURECLI/2.24.2 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006?api-version=2020-01-01-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006","name":"nanthiaks1006","type":"microsoft.kubernetes/connectedclusters","location":"eastus2euap","tags":{},"identity":{"principalId":"4819e8b8-75f1-43c0-b1f3-c2866dcaada2","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"properties":{"provisioningState":"Succeeded","connectivityStatus":"Connected","agentPublicKeyCertificate":"MIICCgKCAgEA5Av/NZAJ5+V5E9Mswh5fjqTK8pEXVGhcYLO2/qBPxGctQ2jYWvqnrqxumZQhD8AXwUAPNm5NZ4NOhkoZo2YN3xPf8Tsxr2wrKkl/EeX55Jlnvw3U9jjQRES7fMR4Io7e0EUavLlKI0SHA3i9AsGzG041Df8BKEcRBpjvpmIkG9BWvikHELCOmhv0dr6Lx4ovMDBf8uP17QdilDhyxorEZeLbd/VIZWjdFHYK+rO4tCadaeecF2GdtNUVdv9uEyRRq4LshZnw5BQjMquqm9W/aIDsPMU959Uotf9aW4UDlW9iybyBRSFtLOuxd+cmJ9oHw9riAq3Fi5UoHDa29kDNp4PaJJBgpUaSfGdKpymDxrtOtchbBdaV0dPaXeVCUMNHXhN9GRkWIHKPVV+qMPOOchbgNf/G/F325h3qfRwuW9pV4Y8MD24h3BZ3PEuyT15CY0BiaPKdpOtER2+K5aUZnI9ihXYEXS1jsxaa5aIimVEZOREPCPk7mI7A3vqjPe4hBGvRtGFLa/dg44WXLetorJU8kFZdP2/hdbxZPMz8XdLbm0kroebp+D+ruDk7QSqsac+kJ8q8ABGHX1QeWUo0DGIMTS9pJyRaFzG8ftudtkYsOBR1NDTkAi3iK+XPntpzcIJHQ/nk/WAMMoAFYJYvzFblxEzOMVD44dnADrucE3cCAwEAAQ==","aadProfile":{"tenantId":"","clientAppId":"","serverAppId":""},"distribution":"aks","infrastructure":"azure","kubernetesVersion":"1.22.1","totalNodeCount":3,"agentVersion":"1.5.2","totalCoreCount":6,"lastConnectivityTime":"2021-10-13T22:54:04.715Z","managedIdentityCertificateExpirationTime":"2022-01-04T23:12:00Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '1527' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:54:10 GMT + etag: + - '"0d006390-0000-3400-0000-616763920000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.25.1 + method: GET + uri: https://raw.githubusercontent.com/Azure/osm-azure/v0.9.2/charts/osm-arc/values.yaml + response: + body: + string: "# Default values for osm-arc.\n# This is a YAML-formatted file.\n# + Declare variables to be passed into your templates.\n\n## Values populated + by Azure Arc K8s RP during the installation of the extension\nAzure:\n Cluster:\n + \ Distribution: \n\nOpenServiceMesh:\n ignoreNamespaces: + \"kube-system azure-arc arc-osm-system\"\n testedDistros: \"aks gke eks openshift + rancher_rke\"\n\nosm:\n OpenServiceMesh:\n enableDebugServer: false\n + \ enablePermissiveTrafficPolicy: true\n image:\n registry: mcr.microsoft.com/oss/openservicemesh\n + \ enforceSingleMesh: true\n deployPrometheus: false\n deployJaeger: + false\n webhookConfigNamePrefix: arc-osm-webhook\n sidecarImage: mcr.microsoft.com/oss/envoyproxy/envoy:v1.18.3\n + \ osmController:\n podLabels: {\n app.kubernetes.io/component: + osm-controller\n }\n injector:\n podLabels: {\n app.kubernetes.io/component: + osm-controller\n }\n\nalpine:\n image:\n name: \"mcr.microsoft.com/azure-policy/alpine\"\n + \ tag: \"prod_20200505.1\"\n\nkubectl:\n image:\n name: \"bitnami/kubectl\"\n + \ tag: \"latest\"\n\nhelm:\n image:\n name: \"alpine/helm\"\n tag: + \"latest\"\n" + headers: + accept-ranges: + - bytes + access-control-allow-origin: + - '*' + cache-control: + - max-age=300 + connection: + - keep-alive + content-length: + - '1146' + content-security-policy: + - default-src 'none'; style-src 'unsafe-inline'; sandbox + content-type: + - text/plain; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:54:11 GMT + etag: + - W/"bb73fdc51d1aed007544edbbcb7b2c2da2c236cd18aeae0f55e91530aba0ef44" + expires: + - Wed, 13 Oct 2021 22:59:11 GMT + source-age: + - '0' + strict-transport-security: + - max-age=31536000 + vary: + - Authorization,Accept-Encoding,Origin + via: + - 1.1 varnish + x-cache: + - MISS + x-cache-hits: + - '0' + x-content-type-options: + - nosniff + x-fastly-request-id: + - ca005840835efe516f998ff0e96afecafc5ca333 + x-frame-options: + - deny + x-github-request-id: + - 534E:1F28:48016A:6A26FC:61675E67 + x-served-by: + - cache-sea4436-SEA + x-timer: + - S1634165651.917353,VS0,VE160 + x-xss-protection: + - 1; mode=block + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension create + Connection: + - keep-alive + ParameterSetName: + - -g -n -c --cluster-type --extension-type --release-train --version + User-Agent: + - AZURECLI/2.25.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KubernetesConfiguration?api-version=2021-04-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"}],"resourceTypes":[{"resourceType":"sourceControlConfigurations","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","East - US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-03-01","capabilities":"SupportsExtension"},{"resourceType":"extensions","locations":["East - US","West Europe","West Central US","West US 2","South Central US","East US - 2","North Europe","UK South","Southeast Asia","Australia East","France Central","East - US 2 EUAP"],"apiVersions":["2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, - SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["2021-05-01-preview","2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"capabilities":"None"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' + 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","East US 2 EUAP"],"apiVersions":["2021-03-01","2020-10-01-preview","2020-07-01-preview","2019-11-01-preview"],"defaultApiVersion":"2021-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","East US 2 EUAP"],"apiVersions":["2021-05-01-preview","2020-07-01-preview"],"capabilities":"SystemAssignedResourceIdentity, + SupportsExtension"},{"resourceType":"operations","locations":[],"apiVersions":["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"}],"registrationState":"Registered","registrationPolicy":"RegistrationRequired"}' headers: cache-control: - no-cache content-length: - - '1654' + - '1878' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:11 GMT + - Wed, 13 Oct 2021 22:54:10 GMT expires: - '-1' pragma: @@ -49,10 +179,9 @@ interactions: code: 200 message: OK - request: - body: '{"location": "", "properties": {"extensionType": "microsoft.openservicemesh", - "autoUpgradeMinorVersion": false, "releaseTrain": "pilot", "version": "0.8.3", - "scope": {"cluster": {}}, "configurationSettings": {}, "configurationProtectedSettings": - {}}}' + body: '{"properties": {"extensionType": "microsoft.openservicemesh", "releaseTrain": + "pilot", "version": "0.9.2", "scope": {"cluster": {}}, "configurationSettings": + {}, "configurationProtectedSettings": {}}}' headers: Accept: - application/json @@ -63,48 +192,232 @@ interactions: Connection: - keep-alive Content-Length: - - '250' + - '200' Content-Type: - - application/json; charset=utf-8 + - application/json ParameterSetName: - -g -n -c --cluster-type --extension-type --release-train --version User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2021-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"configurationSettings":{},"statuses":[],"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.8.3","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-06-22T23:19:13.9750935+00:00","lastModifiedTime":"2021-06-22T23:19:13.9750935+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.9.2","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"provisioningState":"Creating","installState":"Unknown","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:09:54.4243492+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-13T22:54:12.9030808+00:00"}}' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d?api-Version=2021-09-01 cache-control: - no-cache content-length: - - '704' + - '853' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:13 GMT + - Wed, 13 Oct 2021 22:54:12 GMT + expires: + - '-1' + location: + - https://eastus2euap.rp.kubernetesconfiguration.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension create + Connection: + - keep-alive + ParameterSetName: + - -g -n -c --cluster-type --extension-type --release-train --version + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d","name":"b5613d65-be6a-422d-aae0-a7d0a6492f1d","status":"Creating"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '336' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:54:43 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension create + Connection: + - keep-alive + ParameterSetName: + - -g -n -c --cluster-type --extension-type --release-train --version + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d","name":"b5613d65-be6a-422d-aae0-a7d0a6492f1d","status":"Creating"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '336' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:55:14 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension create + Connection: + - keep-alive + ParameterSetName: + - -g -n -c --cluster-type --extension-type --release-train --version + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/b5613d65-be6a-422d-aae0-a7d0a6492f1d","name":"b5613d65-be6a-422d-aae0-a7d0a6492f1d","status":"Succeeded"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '337' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:55:44 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension create + Connection: + - keep-alive + ParameterSetName: + - -g -n -c --cluster-type --extension-type --release-train --version + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.9.2","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:09:54.4243492+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-13T22:54:12.9030808+00:00"}}' + headers: + api-supported-versions: + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '856' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:55:45 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' status: code: 200 message: OK @@ -122,38 +435,40 @@ interactions: ParameterSetName: - -c -g --cluster-type User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2021-09-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.8.3","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-06-22T23:19:13.9750935+00:00","lastModifiedTime":"2021-06-22T23:19:13.9750935+00:00"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/hci22jan21","name":"hci22jan21","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.azstackhci.operator","autoUpgradeMinorVersion":true,"releaseTrain":"stable","version":"1.0.0","scope":{"cluster":{"releaseNamespace":null}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-01-22T20:49:34.3336157+00:00","lastModifiedTime":"2021-01-22T20:49:34.3336249+00:00"}}],"nextLink":null}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.9.2","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:09:54.4243492+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-13T22:54:12.9030808+00:00"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/azuremonitor-containers","name":"azuremonitor-containers","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.azuremonitor.containers","autoUpgradeMinorVersion":true,"releaseTrain":"Stable","version":"2.8.2","scope":{"cluster":{"releaseNamespace":"azuremonitor-containers"}},"provisioningState":"Failed","installState":"Failed","configurationSettings":{"logAnalyticsWorkspaceResourceID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-0e750457-5252-493e-95a3-e40e6a460bf0-eus"},"configurationProtectedSettings":{"omsagent.secret.wsid":"","omsagent.secret.key":""},"statuses":[{"code":"InstallationFailed","displayStatus":null,"level":null,"message":"Error: + {failed to install chart from path [] for release [azuremonitor-containers]: + err [unable to build kubernetes objects from release manifest: [unable to + recognize \"\": no matches for kind \"ClusterRole\" in version \"rbac.authorization.k8s.io/v1beta1\", + unable to recognize \"\": no matches for kind \"ClusterRoleBinding\" in version + \"rbac.authorization.k8s.io/v1beta1\"]]} occurred while doing the operation + : {Installing the extension} on the config","time":null}],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T20:18:32.2074073+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-07T20:18:32.2074073+00:00"},"identity":{"type":"SystemAssigned","principalId":"e0e4d71f-00be-4972-9395-e4babc04bdd9"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/cassandra","name":"cassandra","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"cassandradatacentersoperator","autoUpgradeMinorVersion":true,"releaseTrain":"Stable","version":"1.1.18","scope":{"namespace":{"targetNamespace":"cassandrans"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:56:12.7708078+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-07T00:56:12.7708078+00:00"},"identity":{"type":"SystemAssigned","principalId":"93e7c7d2-2fe0-4e30-9742-3d4230a3cd6a"}}],"nextLink":null}' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 cache-control: - no-cache content-length: - - '1337' + - '3627' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:14 GMT + - Wed, 13 Oct 2021 22:55:47 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding x-content-type-options: - nosniff status: @@ -173,38 +488,34 @@ interactions: ParameterSetName: - -c -g -n --cluster-type User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2021-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"configurationSettings":{},"statuses":[],"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.8.3","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-06-22T23:19:13.9750935+00:00","lastModifiedTime":"2021-06-22T23:19:13.9750935+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.9.2","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:09:54.4243492+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-13T22:54:12.9030808+00:00"}}' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 cache-control: - no-cache content-length: - - '704' + - '856' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:15 GMT + - Wed, 13 Oct 2021 22:55:48 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding x-content-type-options: - nosniff status: @@ -224,38 +535,34 @@ interactions: ParameterSetName: - -g -c -n --cluster-type -y User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2021-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"configurationSettings":{},"statuses":[],"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.8.3","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-06-22T23:19:13.9750935+00:00","lastModifiedTime":"2021-06-22T23:19:13.9750935+00:00"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh","name":"openservicemesh","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.openservicemesh","autoUpgradeMinorVersion":false,"releaseTrain":"pilot","version":"0.9.2","scope":{"cluster":{"releaseNamespace":"arc-osm-system"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:09:54.4243492+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-13T22:54:12.9030808+00:00"}}' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 cache-control: - no-cache content-length: - - '704' + - '856' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:16 GMT + - Wed, 13 Oct 2021 22:55:50 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding x-content-type-options: - nosniff status: @@ -277,32 +584,214 @@ interactions: ParameterSetName: - -g -c -n --cluster-type -y User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh?api-version=2021-09-01&forceDelete=false response: body: - string: '{"content":null,"statusCode":200,"headers":[],"version":"1.1","reasonPhrase":"OK","trailingHeaders":[],"requestMessage":null,"isSuccessStatusCode":true}' + string: '' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e?api-Version=2021-09-01 cache-control: - no-cache content-length: - - '152' + - '0' + date: + - Wed, 13 Oct 2021 22:55:51 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e","name":"c242312c-0d18-413d-8b0a-efd7cfd0ad0e","status":"Deleting"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '336' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:17 GMT + - Wed, 13 Oct 2021 22:56:21 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e","name":"c242312c-0d18-413d-8b0a-efd7cfd0ad0e","status":"Deleting"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '336' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:56:52 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e","name":"c242312c-0d18-413d-8b0a-efd7cfd0ad0e","status":"Deleting"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '336' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:57:23 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - k8s-extension delete + Connection: + - keep-alive + ParameterSetName: + - -g -c -n --cluster-type -y + User-Agent: + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e?api-Version=2021-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/ConnectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/openservicemesh/operations/c242312c-0d18-413d-8b0a-efd7cfd0ad0e","name":"c242312c-0d18-413d-8b0a-efd7cfd0ad0e","status":"Succeeded"}' + headers: + api-supported-versions: + - 2019-11-01-Preview, 2021-05-01-preview, 2021-06-01-preview, 2021-09-01 + cache-control: + - no-cache + content-length: + - '337' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 13 Oct 2021 22:57:53 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: @@ -311,8 +800,6 @@ interactions: - Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-deletes: - - '14999' status: code: 200 message: OK @@ -330,38 +817,40 @@ interactions: ParameterSetName: - -c -g --cluster-type User-Agent: - - python/3.9.0 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.4 - azure-mgmt-kubernetesconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.24.2 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-kubernetesconfiguration/1.0.0b1 Python/3.8.0 + (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2020-07-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions?api-version=2021-09-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg0923/providers/Microsoft.Kubernetes/connectedClusters/nanthicluster0923/providers/Microsoft.KubernetesConfiguration/extensions/hci22jan21","name":"hci22jan21","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.azstackhci.operator","autoUpgradeMinorVersion":true,"releaseTrain":"stable","version":"1.0.0","scope":{"cluster":{"releaseNamespace":null}},"installState":"Pending","lastStatusTime":null,"errorInfo":{},"creationTime":"2021-01-22T20:49:34.3336157+00:00","lastModifiedTime":"2021-01-22T20:49:34.3336249+00:00"}}],"nextLink":null}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/azuremonitor-containers","name":"azuremonitor-containers","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"microsoft.azuremonitor.containers","autoUpgradeMinorVersion":true,"releaseTrain":"Stable","version":"2.8.2","scope":{"cluster":{"releaseNamespace":"azuremonitor-containers"}},"provisioningState":"Failed","installState":"Failed","configurationSettings":{"logAnalyticsWorkspaceResourceID":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/defaultresourcegroup-eus/providers/microsoft.operationalinsights/workspaces/defaultworkspace-0e750457-5252-493e-95a3-e40e6a460bf0-eus"},"configurationProtectedSettings":{"omsagent.secret.wsid":"","omsagent.secret.key":""},"statuses":[{"code":"InstallationFailed","displayStatus":null,"level":null,"message":"Error: + {failed to install chart from path [] for release [azuremonitor-containers]: + err [unable to build kubernetes objects from release manifest: [unable to + recognize \"\": no matches for kind \"ClusterRole\" in version \"rbac.authorization.k8s.io/v1beta1\", + unable to recognize \"\": no matches for kind \"ClusterRoleBinding\" in version + \"rbac.authorization.k8s.io/v1beta1\"]]} occurred while doing the operation + : {Installing the extension} on the config","time":null}],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T20:18:32.2074073+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-07T20:18:32.2074073+00:00"},"identity":{"type":"SystemAssigned","principalId":"e0e4d71f-00be-4972-9395-e4babc04bdd9"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nanthirg1006/providers/Microsoft.Kubernetes/connectedClusters/nanthiaks1006/providers/Microsoft.KubernetesConfiguration/extensions/cassandra","name":"cassandra","type":"Microsoft.KubernetesConfiguration/extensions","properties":{"extensionType":"cassandradatacentersoperator","autoUpgradeMinorVersion":true,"releaseTrain":"Stable","version":"1.1.18","scope":{"namespace":{"targetNamespace":"cassandrans"}},"provisioningState":"Succeeded","installState":"Installed","configurationSettings":{},"configurationProtectedSettings":{},"statuses":[],"aksAssignedIdentity":null},"systemData":{"createdBy":null,"createdByType":null,"createdAt":"2021-10-07T00:56:12.7708078+00:00","lastModifiedBy":null,"lastModifiedByType":null,"lastModifiedAt":"2021-10-07T00:56:12.7708078+00:00"},"identity":{"type":"SystemAssigned","principalId":"93e7c7d2-2fe0-4e30-9742-3d4230a3cd6a"}}],"nextLink":null}' headers: api-supported-versions: - - 2020-07-01-Preview, 2021-05-01-preview + - 2020-07-01-Preview, 2021-05-01-preview, 2021-09-01 cache-control: - no-cache content-length: - - '673' + - '2770' content-type: - application/json; charset=utf-8 date: - - Tue, 22 Jun 2021 23:19:19 GMT + - Wed, 13 Oct 2021 22:57:55 GMT expires: - '-1' pragma: - no-cache - server: - - openresty/1.15.8.2 strict-transport-security: - max-age=31536000; includeSubDomains transfer-encoding: - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding x-content-type-options: - nosniff status: 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 53db4ce2c2d..47dc82ae37b 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 @@ -18,12 +18,12 @@ def test_k8s_extension(self): resource_type = 'microsoft.openservicemesh' self.kwargs.update({ 'name': 'openservicemesh', - 'rg': 'nanthirg0923', - 'cluster_name': 'nanthicluster0923', + 'rg': 'nanthirg1006', + 'cluster_name': 'nanthiaks1006', 'cluster_type': 'connectedClusters', 'extension_type': resource_type, 'release_train': 'pilot', - 'version': '0.8.3' + 'version': '0.9.2' }) self.cmd('k8s-extension create -g {rg} -n {name} -c {cluster_name} --cluster-type {cluster_type} ' @@ -35,9 +35,9 @@ def test_k8s_extension(self): self.check('resourceGroup', '{rg}'), self.check('extensionType', '{extension_type}') ] - ) + ) - # Update is disabled for now + # 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=[ # self.check('tags.foo', 'boo') # ]) 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 89bdc90391d..abc45d20646 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_configuration.py @@ -29,7 +29,7 @@ class SourceControlConfigurationClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-kubernetesconfiguration/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/_metadata.json b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_metadata.json new file mode 100644 index 00000000000..01a86003f7e --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/_metadata.json @@ -0,0 +1,105 @@ +{ + "chosen_version": "2021-09-01", + "total_api_version_list": ["2021-09-01"], + "client": { + "name": "SourceControlConfigurationClient", + "filename": "_source_control_configuration_client", + "description": "KubernetesConfiguration Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "extensions": "ExtensionsOperations", + "operation_status": "OperationStatusOperations", + "operations": "Operations" + } +} \ No newline at end of file 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 71f3974f333..7b567be1cb6 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 @@ -19,24 +19,24 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations from .operations import ExtensionsOperations +from .operations import OperationStatusOperations +from .operations import Operations from . import models class SourceControlConfigurationClient(object): """KubernetesConfiguration Client. - :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.SourceControlConfigurationsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.ExtensionsOperations + :vartype extensions: azure.mgmt.kubernetesconfiguration.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.kubernetesconfiguration.operations.OperationStatusOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -60,11 +60,11 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.source_control_configurations = SourceControlConfigurationsOperations( + self.extensions = ExtensionsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) def _send_request(self, http_request, **kwargs): @@ -78,7 +78,7 @@ def _send_request(self, http_request, **kwargs): :rtype: ~azure.core.pipeline.transport.HttpResponse """ path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } http_request.url = self._client.format_url(http_request.url, **path_format_arguments) stream = kwargs.pop("stream", True) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_configuration.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_configuration.py index e15dc551cae..3f22841a050 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_configuration.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_configuration.py @@ -27,7 +27,7 @@ class SourceControlConfigurationClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The ID of the target subscription. :type subscription_id: str """ @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01-preview" + self.api_version = "2021-09-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-kubernetesconfiguration/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_source_control_configuration_client.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_source_control_configuration_client.py index a03dc102973..a8c84244f44 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_source_control_configuration_client.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/_source_control_configuration_client.py @@ -17,24 +17,24 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations from .operations import ExtensionsOperations +from .operations import OperationStatusOperations +from .operations import Operations from .. import models class SourceControlConfigurationClient(object): """KubernetesConfiguration Client. - :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.SourceControlConfigurationsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: azure.mgmt.kubernetesconfiguration.aio.operations.ExtensionsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.kubernetesconfiguration.aio.operations.OperationStatusOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.kubernetesconfiguration.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -57,11 +57,11 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - self.source_control_configurations = SourceControlConfigurationsOperations( + self.extensions = ExtensionsOperations( self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( + self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: @@ -74,7 +74,7 @@ async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> Async :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } http_request.url = self._client.format_url(http_request.url, **path_format_arguments) stream = kwargs.pop("stream", True) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/__init__.py index 2e68d5ecb0c..632ac4c1eeb 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/__init__.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/__init__.py @@ -6,12 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._source_control_configurations_operations import SourceControlConfigurationsOperations -from ._operations import Operations from ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._operations import Operations __all__ = [ - 'SourceControlConfigurationsOperations', - 'Operations', 'ExtensionsOperations', + 'OperationStatusOperations', + 'Operations', ] diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_type_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_type_operations.py new file mode 100644 index 00000000000..8253dcae713 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_type_operations.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ClusterExtensionTypeOperations: + """ClusterExtensionTypeOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_type: Union[str, "_models.Enum5"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": + """Get Extension Type details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 + :param cluster_type: The Kubernetes cluster resource name - either managedClusters (for AKS + clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum5 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_type_name: Extension type name. + :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.v2021_05_01_preview.models.ExtensionType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_types_operations.py new file mode 100644 index 00000000000..7ff4216acce --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_cluster_extension_types_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ClusterExtensionTypesOperations: + """ClusterExtensionTypesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionTypeList"]: + """Get Extension Types. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extension_type_versions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extension_type_versions_operations.py new file mode 100644 index 00000000000..bd9f2c220fc --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extension_type_versions_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExtensionTypeVersionsOperations: + """ExtensionTypeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + extension_type_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionVersionList"]: + """List available versions for an Extension Type. + + :param location: extension location. + :type location: str + :param extension_type_name: Extension type name. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + list_of_elem = deserialized.versions + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extensions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extensions_operations.py index e92980035ad..f8b1b9c9aa7 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extensions_operations.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_extensions_operations.py @@ -12,7 +12,9 @@ from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models @@ -26,7 +28,7 @@ class ExtensionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models + :type models: ~azure.mgmt.kubernetesconfiguration.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,55 +43,34 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + async def _create_initial( self, resource_group_name: str, cluster_rp: Union[str, "_models.Enum0"], cluster_resource_name: Union[str, "_models.Enum1"], cluster_name: str, - extension_instance_name: str, - extension_instance: "_models.ExtensionInstance", + extension_name: str, + extension: "_models.Extension", **kwargs: Any - ) -> "_models.ExtensionInstance": - """Create a new Kubernetes Cluster Extension Instance. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS - clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 - :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters - (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 - :param cluster_name: The name of the kubernetes cluster. - :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str - :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._create_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -103,24 +84,116 @@ async def create( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstance') + body_content = self._serialize.body(extension, 'Extension') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) + 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, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **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. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. + :type extension: ~azure.mgmt.kubernetesconfiguration.models.Extension + :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.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def get( self, @@ -128,45 +201,45 @@ async def get( cluster_rp: Union[str, "_models.Enum0"], cluster_resource_name: Union[str, "_models.Enum1"], cluster_name: str, - extension_instance_name: str, + extension_name: str, **kwargs: Any - ) -> "_models.ExtensionInstance": - """Gets details of the Kubernetes Cluster Extension Instance. + ) -> "_models.Extension": + """Gets Kubernetes Cluster Extension. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str + :param extension_name: Name of the Extension. + :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :return: Extension, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.models.Extension :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -187,141 +260,185 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) + 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/{extensionInstanceName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore - async def update( + async def _delete_initial( self, resource_group_name: str, cluster_rp: Union[str, "_models.Enum0"], cluster_resource_name: Union[str, "_models.Enum1"], cluster_name: str, - extension_instance_name: str, - extension_instance: "_models.ExtensionInstanceUpdate", + extension_name: str, + force_delete: Optional[bool] = None, **kwargs: Any - ) -> "_models.ExtensionInstance": - """Update an existing Kubernetes Cluster Extension Instance. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS - clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 - :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters - (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 - :param cluster_name: The name of the kubernetes cluster. - :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str - :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-09-01" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore - async def delete( + async def begin_delete( self, resource_group_name: str, cluster_rp: Union[str, "_models.Enum0"], cluster_resource_name: Union[str, "_models.Enum1"], cluster_name: str, - extension_instance_name: str, + extension_name: str, + force_delete: Optional[bool] = None, **kwargs: Any - ) -> None: - """Delete a Kubernetes Cluster Extension Instance. This will cause the Agent to Uninstall the - extension instance from the cluster. + ) -> 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -331,21 +448,116 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(patch_extension, 'PatchExtension') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('Extension', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **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. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.models.PatchExtension + :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.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def list( self, @@ -354,30 +566,30 @@ def list( cluster_resource_name: Union[str, "_models.Enum1"], cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ExtensionInstancesList"]: - """List all Source Control Configurations. + ) -> AsyncIterable["_models.ExtensionsList"]: + """List all Extensions in the cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" def prepare_request(next_link=None): @@ -389,8 +601,8 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), @@ -408,7 +620,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize('ExtensionsList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_location_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_location_extension_types_operations.py new file mode 100644 index 00000000000..f435cdfdcb5 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_location_extension_types_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LocationExtensionTypesOperations: + """LocationExtensionTypesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.ExtensionTypeList"]: + """List all Extension Types. + + :param location: extension location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operation_status_operations.py new file mode 100644 index 00000000000..00a463db54b --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operation_status_operations.py @@ -0,0 +1,204 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations: + """OperationStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.OperationStatusList"]: + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.models.OperationStatusList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationStatusList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + 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. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param operation_id: operation Id. + :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.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operations.py index b9e2205f961..2aeed3f8027 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operations.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/aio/operations/_operations.py @@ -26,7 +26,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models + :type models: ~azure.mgmt.kubernetesconfiguration.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,11 +45,12 @@ def list( self, **kwargs: Any ) -> AsyncIterable["_models.ResourceProviderOperationList"]: - """List all the available operations the KubernetesConfiguration resource provider supports. + """List all the available operations the KubernetesConfiguration resource provider supports, in + this api-version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,7 +58,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/__init__.py index 5d3f8aea197..2bcf3a10bde 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/__init__.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/__init__.py @@ -7,93 +7,80 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import ComplianceStatus - from ._models_py3 import ConfigurationIdentity - from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse - from ._models_py3 import ExtensionInstance - from ._models_py3 import ExtensionInstanceUpdate - from ._models_py3 import ExtensionInstancesList + from ._models_py3 import Extension + from ._models_py3 import ExtensionPropertiesAksAssignedIdentity from ._models_py3 import ExtensionStatus - from ._models_py3 import HelmOperatorProperties + from ._models_py3 import ExtensionsList + from ._models_py3 import Identity + from ._models_py3 import OperationStatusList + from ._models_py3 import OperationStatusResult + from ._models_py3 import PatchExtension 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 ._models_py3 import Result from ._models_py3 import Scope from ._models_py3 import ScopeCluster from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList from ._models_py3 import SystemData except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ConfigurationIdentity # type: ignore - from ._models import ErrorDefinition # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore - from ._models import ExtensionInstance # type: ignore - from ._models import ExtensionInstanceUpdate # type: ignore - from ._models import ExtensionInstancesList # type: ignore + from ._models import Extension # type: ignore + from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore from ._models import ExtensionStatus # type: ignore - from ._models import HelmOperatorProperties # type: ignore + from ._models import ExtensionsList # type: ignore + from ._models import Identity # type: ignore + from ._models import OperationStatusList # type: ignore + from ._models import OperationStatusResult # type: ignore + from ._models import PatchExtension # type: ignore from ._models import ProxyResource # type: ignore from ._models import Resource # type: ignore from ._models import ResourceProviderOperation # type: ignore from ._models import ResourceProviderOperationDisplay # type: ignore from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore from ._models import Scope # type: ignore from ._models import ScopeCluster # type: ignore from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore from ._models import SystemData # type: ignore from ._source_control_configuration_client_enums import ( - ComplianceStateType, + CreatedByType, Enum0, Enum1, - InstallStateType, LevelType, - MessageLevelType, - OperatorScopeType, - OperatorType, - ProvisioningStateType, - ResourceIdentityType, + ProvisioningState, ) __all__ = [ - 'ComplianceStatus', - 'ConfigurationIdentity', - 'ErrorDefinition', + 'ErrorAdditionalInfo', + 'ErrorDetail', 'ErrorResponse', - 'ExtensionInstance', - 'ExtensionInstanceUpdate', - 'ExtensionInstancesList', + 'Extension', + 'ExtensionPropertiesAksAssignedIdentity', 'ExtensionStatus', - 'HelmOperatorProperties', + 'ExtensionsList', + 'Identity', + 'OperationStatusList', + 'OperationStatusResult', + 'PatchExtension', 'ProxyResource', 'Resource', 'ResourceProviderOperation', 'ResourceProviderOperationDisplay', 'ResourceProviderOperationList', - 'Result', 'Scope', 'ScopeCluster', 'ScopeNamespace', - 'SourceControlConfiguration', - 'SourceControlConfigurationList', 'SystemData', - 'ComplianceStateType', + 'CreatedByType', 'Enum0', 'Enum1', - 'InstallStateType', 'LevelType', - 'MessageLevelType', - 'OperatorScopeType', - 'OperatorType', - 'ProvisioningStateType', - 'ResourceIdentityType', + 'ProvisioningState', ] diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models.py index 9370d28bbff..55d57ebde1f 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models.py @@ -10,132 +10,90 @@ import msrest.serialization -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.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, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ConfigurationIdentity(msrest.serialization.Model): - """Identity for the managed cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by the - configuration. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by the - configuration. - :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an - implicitly created identity. Type 'None' will not use Managed Identity for the configuration. - Possible values include: "SystemAssigned", "None". - :type type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + 'type': {'readonly': True}, + 'info': {'readonly': True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(ConfigurationIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorDefinition(msrest.serialization.Model): - """Error definition. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :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.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.kubernetesconfiguration.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__( self, **kwargs ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. + """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: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition + :param error: The error object. + :type error: ~azure.mgmt.kubernetesconfiguration.models.ErrorDetail """ - _validation = { - 'error': {'readonly': True}, - } - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( @@ -143,23 +101,22 @@ def __init__( **kwargs ): super(ErrorResponse, self).__init__(**kwargs) - self.error = None + self.error = kwargs.get('error', None) class Resource(msrest.serialization.Model): - """The Resource model definition. + """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: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -172,7 +129,6 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -183,23 +139,21 @@ def __init__( self.id = None self.name = None self.type = None - self.system_data = kwargs.get('system_data', None) class ProxyResource(Resource): - """ARM proxy 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: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -212,7 +166,6 @@ class ProxyResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -222,82 +175,80 @@ def __init__( super(ProxyResource, self).__init__(**kwargs) -class ExtensionInstance(ProxyResource): - """The Extension Instance object. +class Extension(ProxyResource): + """The Extension object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param system_data: Top level metadata + :param location: Location of resource type + :type location: str + :param identity: Identity of the Extension resource. + :type identity: ~azure.mgmt.kubernetesconfiguration.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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.models.SystemData :param 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. :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade + :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a - specific version. autoUpgradeMinorVersion must be 'false'. + :param version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :param scope: Scope at which the extension is installed. + :type scope: ~azure.mgmt.kubernetesconfiguration.models.Scope :param configuration_settings: Configuration settings, as name-value pairs for configuring this - instance of the extension. + extension. :type configuration_settings: dict[str, str] :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this instance of the extension. + name-value pairs for configuring this extension. :type configuration_protected_settings: dict[str, str] - :ivar install_state: Status of installation of this instance of the extension. Possible values - include: "Pending", "Installed", "Failed". - :vartype install_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] - :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the - client (user). - :vartype creation_time: str - :ivar last_modified_time: DateLiteral (per ISO8601) noting the time the resource was modified - by the client (user). - :vartype last_modified_time: str - :ivar last_status_time: DateLiteral (per ISO8601) noting the time of last status from the - agent. - :vartype last_status_time: str - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity - :param location: Location of resource type - :type location: str + :ivar provisioning_state: The provisioning state of the extension resource. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.models.ProvisioningState + :param statuses: Status from this extension. + :type statuses: list[~azure.mgmt.kubernetesconfiguration.models.ExtensionStatus] + :param error_info: The error detail. + :type error_info: ~azure.mgmt.kubernetesconfiguration.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 + :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :type aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.models.ExtensionPropertiesAksAssignedIdentity """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'install_state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'last_status_time': {'readonly': True}, - 'error_info': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'custom_location_settings': {'readonly': True}, + 'package_uri': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, @@ -306,110 +257,113 @@ class ExtensionInstance(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'Scope'}, 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'install_state': {'key': 'properties.installState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'}, - 'identity': {'key': 'identity', 'type': 'ConfigurationIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, + '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'}, } def __init__( self, **kwargs ): - super(ExtensionInstance, self).__init__(**kwargs) + super(Extension, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.identity = kwargs.get('identity', None) + self.system_data = None self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) self.release_train = kwargs.get('release_train', "Stable") self.version = kwargs.get('version', None) self.scope = kwargs.get('scope', None) self.configuration_settings = kwargs.get('configuration_settings', None) self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.install_state = None + self.provisioning_state = None self.statuses = kwargs.get('statuses', None) - self.creation_time = None - self.last_modified_time = None - self.last_status_time = None - self.error_info = None - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) + self.error_info = kwargs.get('error_info', None) + self.custom_location_settings = None + self.package_uri = None + self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) -class ExtensionInstancesList(msrest.serialization.Model): - """Result of the request to list Extension Instances. It contains a list of ExtensionInstance objects and a URL link to get the next set of results. +class ExtensionPropertiesAksAssignedIdentity(msrest.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 value: List of Extension Instances within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance] - :ivar next_link: URL to get the next set of extension instance objects, if any. - :vartype next_link: str + :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 + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ExtensionInstancesList, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) -class ExtensionInstanceUpdate(msrest.serialization.Model): - """Update Extension Instance request object. +class ExtensionsList(msrest.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. - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension - Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. - autoUpgradeMinorVersion must be 'false'. - :type version: str + 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.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 = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Extension]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ExtensionInstanceUpdate, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) + super(ExtensionsList, self).__init__(**kwargs) + self.value = None + self.next_link = None class ExtensionStatus(msrest.serialization.Model): - """Status from this instance of the extension. + """Status from the extension. :param code: Status code provided by the Extension. :type code: str - :param display_status: Short description of status of this instance of the extension. + :param display_status: Short description of status of the extension. :type display_status: str :param level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. + :type level: str or ~azure.mgmt.kubernetesconfiguration.models.LevelType + :param message: Detailed message of the status from the Extension. :type message: str :param time: DateLiteral (per ISO8601) noting the time of installation status. :type time: str @@ -435,27 +389,150 @@ def __init__( self.time = kwargs.get('time', None) -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. +class Identity(msrest.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 + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type 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, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class OperationStatusList(msrest.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.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 + ): + super(OperationStatusList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(msrest.serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :param id: Fully qualified ID for the async operation. + :type id: str + :param name: Name of the async operation. + :type name: str + :param status: Required. Operation status. + :type status: str + :param properties: Additional information, if available. + :type properties: dict[str, str] + :param error: The error detail. + :type error: ~azure.mgmt.kubernetesconfiguration.models.ErrorDetail """ + _validation = { + 'status': {'required': True}, + } + _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, + '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, **kwargs ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) + super(OperationStatusResult, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.status = kwargs['status'] + self.properties = kwargs.get('properties', None) + self.error = kwargs.get('error', None) + + +class PatchExtension(msrest.serialization.Model): + """The Extension Patch Request object. + + :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :type auto_upgrade_minor_version: bool + :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :type release_train: str + :param version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :type version: str + :param configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :type configuration_settings: dict[str, str] + :param configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :type 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, + **kwargs + ): + super(PatchExtension, self).__init__(**kwargs) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) + self.release_train = kwargs.get('release_train', "Stable") + self.version = kwargs.get('version', None) + self.configuration_settings = kwargs.get('configuration_settings', None) + self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) class ResourceProviderOperation(msrest.serialization.Model): @@ -466,20 +543,23 @@ class ResourceProviderOperation(msrest.serialization.Model): :param name: Operation name, in format of {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay + :type display: ~azure.mgmt.kubernetesconfiguration.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__( @@ -490,6 +570,7 @@ def __init__( self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.is_data_action = None + self.origin = None class ResourceProviderOperationDisplay(msrest.serialization.Model): @@ -529,8 +610,7 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] + :type value: list[~azure.mgmt.kubernetesconfiguration.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str """ @@ -553,32 +633,13 @@ def __init__( self.next_link = None -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - class Scope(msrest.serialization.Model): - """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. + """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + :param cluster: Specifies that the scope of the extension is Cluster. + :type cluster: ~azure.mgmt.kubernetesconfiguration.models.ScopeCluster + :param namespace: Specifies that the scope of the extension is Namespace. + :type namespace: ~azure.mgmt.kubernetesconfiguration.models.ScopeNamespace """ _attribute_map = { @@ -596,10 +657,10 @@ def __init__( class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Cluster. + """Specifies that the scope of the extension is Cluster. :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extensionInstance. If this namespace does not exist, it will be created. + scoped extension. If this namespace does not exist, it will be created. :type release_namespace: str """ @@ -616,10 +677,10 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Namespace. + """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace - scoped extensionInstance. If this namespace does not exist, it will be created. + :param target_namespace: Namespace where the extension will be created for an Namespace scoped + extension. If this namespace does not exist, it will be created. :type target_namespace: str """ @@ -635,170 +696,25 @@ def __init__( self.target_namespace = kwargs.get('target_namespace', None) -class SourceControlConfiguration(ProxyResource): - """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: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.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 - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.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.v2020_07_01_preview.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 - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class SystemData(msrest.serialization.Model): - """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. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for 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: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.kubernetesconfiguration.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - _attribute_map = { 'created_by': {'key': 'createdBy', 'type': 'str'}, 'created_by_type': {'key': 'createdByType', 'type': 'str'}, @@ -813,9 +729,9 @@ def __init__( **kwargs ): super(SystemData, self).__init__(**kwargs) - self.created_by = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models_py3.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models_py3.py index a3cb0d37faf..fae1bb96772 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models_py3.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_models_py3.py @@ -15,165 +15,115 @@ from ._source_control_configuration_client_enums import * -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.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, "MessageLevelType"]] = None, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = last_config_applied - self.message = message - self.message_level = message_level - - -class ConfigurationIdentity(msrest.serialization.Model): - """Identity for the managed cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by the - configuration. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by the - configuration. - :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an - implicitly created identity. Type 'None' will not use Managed Identity for the configuration. - Possible values include: "SystemAssigned", "None". - :type type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, + 'type': {'readonly': True}, + 'info': {'readonly': True}, } _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, **kwargs ): - super(ConfigurationIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorDefinition(msrest.serialization.Model): - """Error definition. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :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.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.kubernetesconfiguration.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + '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, - *, - code: str, - message: str, **kwargs ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = code - self.message = message + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. + """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: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition + :param error: The error object. + :type error: ~azure.mgmt.kubernetesconfiguration.models.ErrorDetail """ - _validation = { - 'error': {'readonly': True}, - } - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, + *, + error: Optional["ErrorDetail"] = None, **kwargs ): super(ErrorResponse, self).__init__(**kwargs) - self.error = None + self.error = error class Resource(msrest.serialization.Model): - """The Resource model definition. + """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: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -186,36 +136,31 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, - *, - system_data: Optional["SystemData"] = None, **kwargs ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None - self.system_data = system_data class ProxyResource(Resource): - """ARM proxy 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: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -228,94 +173,89 @@ class ProxyResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, - *, - system_data: Optional["SystemData"] = None, **kwargs ): - super(ProxyResource, self).__init__(system_data=system_data, **kwargs) + super(ProxyResource, self).__init__(**kwargs) -class ExtensionInstance(ProxyResource): - """The Extension Instance object. +class Extension(ProxyResource): + """The Extension object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param system_data: Top level metadata + :param location: Location of resource type + :type location: str + :param identity: Identity of the Extension resource. + :type identity: ~azure.mgmt.kubernetesconfiguration.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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.models.SystemData :param 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. :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade + :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a - specific version. autoUpgradeMinorVersion must be 'false'. + :param version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :param scope: Scope at which the extension is installed. + :type scope: ~azure.mgmt.kubernetesconfiguration.models.Scope :param configuration_settings: Configuration settings, as name-value pairs for configuring this - instance of the extension. + extension. :type configuration_settings: dict[str, str] :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this instance of the extension. + name-value pairs for configuring this extension. :type configuration_protected_settings: dict[str, str] - :ivar install_state: Status of installation of this instance of the extension. Possible values - include: "Pending", "Installed", "Failed". - :vartype install_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] - :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the - client (user). - :vartype creation_time: str - :ivar last_modified_time: DateLiteral (per ISO8601) noting the time the resource was modified - by the client (user). - :vartype last_modified_time: str - :ivar last_status_time: DateLiteral (per ISO8601) noting the time of last status from the - agent. - :vartype last_status_time: str - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity - :param location: Location of resource type - :type location: str + :ivar provisioning_state: The provisioning state of the extension resource. Possible values + include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.kubernetesconfiguration.models.ProvisioningState + :param statuses: Status from this extension. + :type statuses: list[~azure.mgmt.kubernetesconfiguration.models.ExtensionStatus] + :param error_info: The error detail. + :type error_info: ~azure.mgmt.kubernetesconfiguration.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 + :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :type aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.models.ExtensionPropertiesAksAssignedIdentity """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'install_state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'last_status_time': {'readonly': True}, - 'error_info': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'custom_location_settings': {'readonly': True}, + 'package_uri': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, @@ -324,33 +264,35 @@ class ExtensionInstance(ProxyResource): 'scope': {'key': 'properties.scope', 'type': 'Scope'}, 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'install_state': {'key': 'properties.installState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'}, - 'identity': {'key': 'identity', 'type': 'ConfigurationIdentity'}, - 'location': {'key': 'location', 'type': 'str'}, + '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'}, } def __init__( self, *, - system_data: Optional["SystemData"] = None, + location: Optional[str] = None, + identity: Optional["Identity"] = None, extension_type: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, + auto_upgrade_minor_version: Optional[bool] = True, release_train: Optional[str] = "Stable", version: Optional[str] = None, scope: Optional["Scope"] = None, configuration_settings: Optional[Dict[str, str]] = None, configuration_protected_settings: Optional[Dict[str, str]] = None, statuses: Optional[List["ExtensionStatus"]] = None, - identity: Optional["ConfigurationIdentity"] = None, - location: Optional[str] = None, + error_info: Optional["ErrorDetail"] = None, + aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): - super(ExtensionInstance, self).__init__(system_data=system_data, **kwargs) + super(Extension, self).__init__(**kwargs) + self.location = location + self.identity = identity + self.system_data = None self.extension_type = extension_type self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -358,92 +300,92 @@ def __init__( self.scope = scope self.configuration_settings = configuration_settings self.configuration_protected_settings = configuration_protected_settings - self.install_state = None + self.provisioning_state = None self.statuses = statuses - self.creation_time = None - self.last_modified_time = None - self.last_status_time = None - self.error_info = None - self.identity = identity - self.location = location + self.error_info = error_info + self.custom_location_settings = None + self.package_uri = None + self.aks_assigned_identity = aks_assigned_identity -class ExtensionInstancesList(msrest.serialization.Model): - """Result of the request to list Extension Instances. It contains a list of ExtensionInstance objects and a URL link to get the next set of results. +class ExtensionPropertiesAksAssignedIdentity(msrest.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 value: List of Extension Instances within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance] - :ivar next_link: URL to get the next set of extension instance objects, if any. - :vartype next_link: str + :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 + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, + *, + type: Optional[str] = None, **kwargs ): - super(ExtensionInstancesList, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type -class ExtensionInstanceUpdate(msrest.serialization.Model): - """Update Extension Instance request object. +class ExtensionsList(msrest.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. - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension - Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. - autoUpgradeMinorVersion must be 'false'. - :type version: str + 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.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 = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Extension]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, - *, - auto_upgrade_minor_version: Optional[bool] = None, - release_train: Optional[str] = "Stable", - version: Optional[str] = None, **kwargs ): - super(ExtensionInstanceUpdate, self).__init__(**kwargs) - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.release_train = release_train - self.version = version + super(ExtensionsList, self).__init__(**kwargs) + self.value = None + self.next_link = None class ExtensionStatus(msrest.serialization.Model): - """Status from this instance of the extension. + """Status from the extension. :param code: Status code provided by the Extension. :type code: str - :param display_status: Short description of status of this instance of the extension. + :param display_status: Short description of status of the extension. :type display_status: str :param level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. + :type level: str or ~azure.mgmt.kubernetesconfiguration.models.LevelType + :param message: Detailed message of the status from the Extension. :type message: str :param time: DateLiteral (per ISO8601) noting the time of installation status. :type time: str @@ -475,30 +417,164 @@ def __init__( self.time = time -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. +class Identity(msrest.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 + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type 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[str] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class OperationStatusList(msrest.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.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 + ): + super(OperationStatusList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class OperationStatusResult(msrest.serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to Azure. + + :param id: Fully qualified ID for the async operation. + :type id: str + :param name: Name of the async operation. + :type name: str + :param status: Required. Operation status. + :type status: str + :param properties: Additional information, if available. + :type properties: dict[str, str] + :param error: The error detail. + :type error: ~azure.mgmt.kubernetesconfiguration.models.ErrorDetail + """ + + _validation = { + 'status': {'required': 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, + name: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(OperationStatusResult, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.properties = properties + self.error = error + + +class PatchExtension(msrest.serialization.Model): + """The Extension Patch Request object. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + of minor version, or not. + :type auto_upgrade_minor_version: bool + :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :type release_train: str + :param version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :type version: str + :param configuration_settings: Configuration settings, as name-value pairs for configuring this + extension. + :type configuration_settings: dict[str, str] + :param configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :type configuration_protected_settings: dict[str, str] """ _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, + '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, *, - chart_version: Optional[str] = None, - chart_values: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = True, + release_train: Optional[str] = "Stable", + version: Optional[str] = None, + configuration_settings: Optional[Dict[str, str]] = None, + configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = chart_version - self.chart_values = chart_values + super(PatchExtension, self).__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 ResourceProviderOperation(msrest.serialization.Model): @@ -509,20 +585,23 @@ class ResourceProviderOperation(msrest.serialization.Model): :param name: Operation name, in format of {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay + :type display: ~azure.mgmt.kubernetesconfiguration.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__( @@ -536,6 +615,7 @@ def __init__( self.name = name self.display = display self.is_data_action = None + self.origin = None class ResourceProviderOperationDisplay(msrest.serialization.Model): @@ -580,8 +660,7 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] + :type value: list[~azure.mgmt.kubernetesconfiguration.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str """ @@ -606,34 +685,13 @@ def __init__( self.next_link = None -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - *, - sample_property: Optional[str] = None, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = sample_property - - class Scope(msrest.serialization.Model): - """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. + """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + :param cluster: Specifies that the scope of the extension is Cluster. + :type cluster: ~azure.mgmt.kubernetesconfiguration.models.ScopeCluster + :param namespace: Specifies that the scope of the extension is Namespace. + :type namespace: ~azure.mgmt.kubernetesconfiguration.models.ScopeNamespace """ _attribute_map = { @@ -654,10 +712,10 @@ def __init__( class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Cluster. + """Specifies that the scope of the extension is Cluster. :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extensionInstance. If this namespace does not exist, it will be created. + scoped extension. If this namespace does not exist, it will be created. :type release_namespace: str """ @@ -676,10 +734,10 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Namespace. + """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace - scoped extensionInstance. If this namespace does not exist, it will be created. + :param target_namespace: Namespace where the extension will be created for an Namespace scoped + extension. If this namespace does not exist, it will be created. :type target_namespace: str """ @@ -697,182 +755,25 @@ def __init__( self.target_namespace = target_namespace -class SourceControlConfiguration(ProxyResource): - """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: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param 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. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.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 - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'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, - *, - system_data: Optional["SystemData"] = None, - repository_url: Optional[str] = None, - operator_namespace: Optional[str] = "default", - operator_instance_name: Optional[str] = None, - operator_type: Optional[Union[str, "OperatorType"]] = None, - operator_params: Optional[str] = None, - configuration_protected_settings: Optional[Dict[str, str]] = None, - operator_scope: Optional[Union[str, "OperatorScopeType"]] = "cluster", - ssh_known_hosts_contents: Optional[str] = None, - enable_helm_operator: Optional[bool] = None, - helm_operator_properties: Optional["HelmOperatorProperties"] = None, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(system_data=system_data, **kwargs) - 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(msrest.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.v2020_07_01_preview.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 - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class SystemData(msrest.serialization.Model): - """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. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for 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: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.kubernetesconfiguration.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - _attribute_map = { 'created_by': {'key': 'createdBy', 'type': 'str'}, 'created_by_type': {'key': 'createdByType', 'type': 'str'}, @@ -884,12 +785,19 @@ class SystemData(msrest.serialization.Model): def __init__( self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs ): super(SystemData, self).__init__(**kwargs) - self.created_by = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None + 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/models/_source_control_configuration_client_enums.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_source_control_configuration_client_enums.py index 825cfccadd1..19b127e8cd4 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_source_control_configuration_client_enums.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/models/_source_control_configuration_client_enums.py @@ -26,15 +26,14 @@ def __getattr__(cls, name): raise AttributeError(name) -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The compliance state of the configuration. +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. """ - PENDING = "Pending" - COMPLIANT = "Compliant" - NONCOMPLIANT = "Noncompliant" - INSTALLED = "Installed" - FAILED = "Failed" + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): @@ -46,14 +45,6 @@ class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class InstallStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Status of installation of this instance of the extension. - """ - - PENDING = "Pending" - INSTALLED = "Installed" - FAILED = "Failed" - class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -62,41 +53,13 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Level of the message. - """ - - ERROR = "Error" - WARNING = "Warning" - INFORMATION = "Information" - -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Scope at which the operator will be installed. +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the extension resource. """ - CLUSTER = "cluster" - NAMESPACE = "namespace" - -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Type of the operator - """ - - FLUX = "Flux" - -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The provisioning state of the resource provider. - """ - - ACCEPTED = "Accepted" - DELETING = "Deleting" - RUNNING = "Running" SUCCEEDED = "Succeeded" FAILED = "Failed" - -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity used for the configuration. Type 'SystemAssigned' will use an implicitly - created identity. Type 'None' will not use Managed Identity for the configuration. - """ - - SYSTEM_ASSIGNED = "SystemAssigned" - NONE = "None" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/__init__.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/__init__.py index 2e68d5ecb0c..632ac4c1eeb 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/__init__.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/__init__.py @@ -6,12 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._source_control_configurations_operations import SourceControlConfigurationsOperations -from ._operations import Operations from ._extensions_operations import ExtensionsOperations +from ._operation_status_operations import OperationStatusOperations +from ._operations import Operations __all__ = [ - 'SourceControlConfigurationsOperations', - 'Operations', 'ExtensionsOperations', + 'OperationStatusOperations', + 'Operations', ] diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_type_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_type_operations.py new file mode 100644 index 00000000000..a2998ac9547 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_type_operations.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ClusterExtensionTypeOperations(object): + """ClusterExtensionTypeOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_type, # type: Union[str, "_models.Enum5"] + cluster_name, # type: str + extension_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ExtensionType" + """Get Extension Type details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 + :param cluster_type: The Kubernetes cluster resource name - either managedClusters (for AKS + clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum5 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_type_name: Extension type name. + :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.v2021_05_01_preview.models.ExtensionType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_types_operations.py new file mode 100644 index 00000000000..8ba2c2d42e9 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_cluster_extension_types_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ClusterExtensionTypesOperations(object): + """ClusterExtensionTypesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExtensionTypeList"] + """Get Extension Types. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extension_type_versions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extension_type_versions_operations.py new file mode 100644 index 00000000000..bca368e1670 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extension_type_versions_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ExtensionTypeVersionsOperations(object): + """ExtensionTypeVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + extension_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExtensionVersionList"] + """List available versions for an Extension Type. + + :param location: extension location. + :type location: str + :param extension_type_name: Extension type name. + :type extension_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionVersionList', pipeline_response) + list_of_elem = deserialized.versions + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extensions_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extensions_operations.py index c3e2b0cf5f4..794ba86c86c 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extensions_operations.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_extensions_operations.py @@ -12,7 +12,9 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models @@ -30,7 +32,7 @@ class ExtensionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models + :type models: ~azure.mgmt.kubernetesconfiguration.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,56 +47,35 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + def _create_initial( self, resource_group_name, # type: str cluster_rp, # type: Union[str, "_models.Enum0"] cluster_resource_name, # type: Union[str, "_models.Enum1"] cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstance" + extension_name, # type: str + extension, # type: "_models.Extension" **kwargs # type: Any ): - # type: (...) -> "_models.ExtensionInstance" - """Create a new Kubernetes Cluster Extension Instance. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS - clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 - :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters - (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 - :param cluster_name: The name of the kubernetes cluster. - :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str - :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + # type: (...) -> "_models.Extension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._create_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -108,24 +89,117 @@ def create( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstance') + body_content = self._serialize.body(extension, 'Extension') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) + 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, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_resource_name, # type: Union[str, "_models.Enum1"] + cluster_name, # type: str + extension_name, # type: str + extension, # type: "_models.Extension" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Extension"] + """Create a new Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param extension: Properties necessary to Create an Extension. + :type extension: ~azure.mgmt.kubernetesconfiguration.models.Extension + :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.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + extension=extension, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def get( self, @@ -133,46 +207,46 @@ def get( cluster_rp, # type: Union[str, "_models.Enum0"] cluster_resource_name, # type: Union[str, "_models.Enum1"] cluster_name, # type: str - extension_instance_name, # type: str + extension_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.ExtensionInstance" - """Gets details of the Kubernetes Cluster Extension Instance. + # type: (...) -> "_models.Extension" + """Gets Kubernetes Cluster Extension. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str + :param extension_name: Name of the Extension. + :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :return: Extension, or the result of cls(response) + :rtype: ~azure.mgmt.kubernetesconfiguration.models.Extension :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -193,143 +267,188 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) + 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/{extensionInstanceName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore - def update( + def _delete_initial( self, resource_group_name, # type: str cluster_rp, # type: Union[str, "_models.Enum0"] cluster_resource_name, # type: Union[str, "_models.Enum1"] cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstanceUpdate" + extension_name, # type: str + force_delete=None, # type: Optional[bool] **kwargs # type: Any ): - # type: (...) -> "_models.ExtensionInstance" - """Update an existing Kubernetes Cluster Extension Instance. - - :param resource_group_name: The name of the resource group. - :type resource_group_name: str - :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS - clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 - :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters - (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 - :param cluster_name: The name of the kubernetes cluster. - :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str - :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExtensionInstance, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstance"] + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2021-09-01" accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExtensionInstance', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, None, {}) - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore - def delete( + def begin_delete( self, resource_group_name, # type: str cluster_rp, # type: Union[str, "_models.Enum0"] cluster_resource_name, # type: Union[str, "_models.Enum1"] cluster_name, # type: str - extension_instance_name, # type: str + extension_name, # type: str + force_delete=None, # type: Optional[bool] **kwargs # type: Any ): - # type: (...) -> None - """Delete a Kubernetes Cluster Extension Instance. This will cause the Agent to Uninstall the - extension instance from the cluster. + # type: (...) -> 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str - :param extension_instance_name: Name of an instance of the Extension. - :type extension_instance_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param force_delete: Delete the extension resource in Azure - not the normal asynchronous + delete. + :type force_delete: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_resource_name, # type: Union[str, "_models.Enum1"] + cluster_name, # type: str + extension_name, # type: str + patch_extension, # type: "_models.PatchExtension" + **kwargs # type: Any + ): + # type: (...) -> "_models.Extension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" + content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -339,21 +458,117 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.delete(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(patch_extension, 'PatchExtension') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('Extension', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_resource_name, # type: Union[str, "_models.Enum1"] + cluster_name, # type: str + extension_name, # type: str + patch_extension, # type: "_models.PatchExtension" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Extension"] + """Patch an existing Kubernetes Cluster Extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param patch_extension: Properties to Patch in an existing Extension. + :type patch_extension: ~azure.mgmt.kubernetesconfiguration.models.PatchExtension + :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.models.Extension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + patch_extension=patch_extension, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Extension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + } - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def list( self, @@ -363,30 +578,30 @@ def list( cluster_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ExtensionInstancesList"] - """List all Source Control Configurations. + # type: (...) -> Iterable["_models.ExtensionsList"] + """List all Extensions in the cluster. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). - :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" def prepare_request(next_link=None): @@ -398,8 +613,8 @@ def prepare_request(next_link=None): # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), @@ -417,7 +632,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize('ExtensionsList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_location_extension_types_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_location_extension_types_operations.py new file mode 100644 index 00000000000..15282cd28e0 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_location_extension_types_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class LocationExtensionTypesOperations(object): + """LocationExtensionTypesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExtensionTypeList"] + """List all Extension Types. + + :param location: extension location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExtensionTypeList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operation_status_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operation_status_operations.py new file mode 100644 index 00000000000..d70023d2104 --- /dev/null +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operation_status_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations(object): + """OperationStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.kubernetesconfiguration.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_resource_name, # type: Union[str, "_models.Enum1"] + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationStatusList"] + """List Async Operations, currently in progress, in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationStatusList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.models.OperationStatusList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationStatusList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_rp, # type: Union[str, "_models.Enum0"] + cluster_resource_name, # type: Union[str, "_models.Enum1"] + cluster_name, # type: str + extension_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OperationStatusResult" + """Get Async Operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param cluster_rp: The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.models.Enum0 + :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters + (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). + :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.models.Enum1 + :param cluster_name: The name of the kubernetes cluster. + :type cluster_name: str + :param extension_name: Name of the Extension. + :type extension_name: str + :param operation_id: operation Id. + :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.models.OperationStatusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), + 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}'} # type: ignore diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operations.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operations.py index 1fe1fbf39b1..fe4ca00195c 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operations.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/operations/_operations.py @@ -30,7 +30,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models + :type models: ~azure.mgmt.kubernetesconfiguration.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -50,11 +50,12 @@ def list( **kwargs # type: Any ): # type: (...) -> Iterable["_models.ResourceProviderOperationList"] - """List all the available operations the KubernetesConfiguration resource provider supports. + """List all the available operations the KubernetesConfiguration resource provider supports, in + this api-version. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,7 +63,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" + api_version = "2021-09-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/src/k8s-extension/setup.py b/src/k8s-extension/setup.py index 69ce92ae3e3..99ef128f8ab 100644 --- a/src/k8s-extension/setup.py +++ b/src/k8s-extension/setup.py @@ -32,7 +32,7 @@ # TODO: Add any additional SDK dependencies here DEPENDENCIES = [] -VERSION = "0.7.1" +VERSION = "1.0.0" with open('README.rst', 'r', encoding='utf-8') as f: README = f.read()