From 2703ee75104ee766a563c4ce2782ab1e395486be Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 17 Nov 2023 19:06:34 +0000 Subject: [PATCH] CodeGen from PR 26741 in Azure/azure-rest-api-specs Merge 2982f564aae7455744e104d7b9ba0b4ff0b53ca8 into eaf8b6f8e3ae429c8100471a9772a4bee9a5e472 --- .../_meta.json | 10 +- .../hybridcontainerservice/_configuration.py | 12 +- .../_hybrid_container_service_mgmt_client.py | 39 +- .../hybridcontainerservice/_serialization.py | 32 +- .../mgmt/hybridcontainerservice/_vendor.py | 28 +- .../aio/_configuration.py | 12 +- .../_hybrid_container_service_mgmt_client.py | 40 +- .../hybridcontainerservice/aio/_vendor.py | 28 + .../aio/operations/__init__.py | 14 +- .../aio/operations/_agent_pool_operations.py | 517 +- ...ontainer_service_mgmt_client_operations.py | 841 +++ .../_hybrid_container_service_operations.py | 183 - .../_hybrid_identity_metadata_operations.py | 262 +- .../_kubernetes_versions_operations.py | 146 + .../aio/operations/_operations.py | 24 +- ...ovisioned_cluster_instances_operations.py} | 799 ++- .../operations/_storage_spaces_operations.py | 858 ---- .../_virtual_networks_operations.py | 335 +- .../aio/operations/_vm_skus_operations.py | 141 + .../hybridcontainerservice/models/__init__.py | 240 +- ...rid_container_service_mgmt_client_enums.py | 121 +- .../models/_models_py3.py | 4524 +++++------------ .../operations/__init__.py | 14 +- .../operations/_agent_pool_operations.py | 646 +-- ...ontainer_service_mgmt_client_operations.py | 1004 ++++ .../_hybrid_container_service_operations.py | 241 - .../_hybrid_identity_metadata_operations.py | 395 +- .../_kubernetes_versions_operations.py | 174 + .../operations/_operations.py | 30 +- ...rovisioned_cluster_instances_operations.py | 1073 ++++ .../_provisioned_clusters_operations.py | 1360 ----- .../operations/_storage_spaces_operations.py | 1055 ---- .../_virtual_networks_operations.py | 437 +- .../operations/_vm_skus_operations.py | 168 + .../create_hybrid_identity_metadata.py | 8 +- .../generated_samples/delete_agent_pool.py | 12 +- .../delete_hybrid_identity_metadata.py | 13 +- ...space.py => delete_kubernetes_versions.py} | 13 +- .../delete_provisioned_cluster.py | 41 - ...=> delete_provisioned_cluster_instance.py} | 13 +- .../delete_virtual_network.py | 9 +- ...ovisioned_cluster.py => delete_vm_skus.py} | 14 +- .../generated_samples/get_agent_pool.py | 7 +- .../get_hybrid_identity_metadata.py | 8 +- ...strators.py => get_kubernetes_versions.py} | 6 +- ...py => get_provisioned_cluster_instance.py} | 11 +- .../generated_samples/get_virtual_network.py | 4 +- ...delete_storage_space.py => get_vm_skus.py} | 11 +- ...ybrid_identity_metadata_list_by_cluster.py | 7 +- ...t_pool_by_provisioned_cluster_instance.py} | 9 +- ...e_group.py => list_kubernetes_versions.py} | 10 +- .../generated_samples/list_operations.py | 2 +- ...ist_provisioned_cluster_by_subscription.py | 39 - ... => list_provisioned_cluster_instances.py} | 10 +- .../list_storage_space_by_subscription.py | 39 - .../list_virtual_network_by_resource_group.py | 2 +- .../list_virtual_network_by_subscription.py | 2 +- .../generated_samples/list_vm_skus.py | 7 +- ...ed_cluster_instance_get_upgrade_profile.py | 40 + ..._cluster_instance_list_admin_kubeconfig.py | 40 + ..._cluster_instance_list_user_kubeconfig.py} | 11 +- ...rovisioned_clusters_get_upgrade_profile.py | 41 - .../generated_samples/put_agent_pool.py | 7 +- ...ge_space.py => put_kubernetes_versions.py} | 23 +- ...py => put_provisioned_cluster_instance.py} | 38 +- .../generated_samples/put_virtual_network.py | 12 +- .../generated_samples/put_vm_skus.py | 46 + .../generated_samples/update_agent_pool.py | 13 +- .../update_virtual_network.py | 4 +- 69 files changed, 7189 insertions(+), 9186 deletions(-) create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_vendor.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_mgmt_client_operations.py delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_kubernetes_versions_operations.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/{_provisioned_clusters_operations.py => _provisioned_cluster_instances_operations.py} (53%) delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_storage_spaces_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_vm_skus_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_mgmt_client_operations.py delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_kubernetes_versions_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_cluster_instances_operations.py delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_clusters_operations.py delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_storage_spaces_operations.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_vm_skus_operations.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{update_storage_space.py => delete_kubernetes_versions.py} (75%) delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{update_provisioned_cluster.py => delete_provisioned_cluster_instance.py} (74%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{get_provisioned_cluster.py => delete_vm_skus.py} (75%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{list_orchestrators.py => get_kubernetes_versions.py} (89%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{get_storage_space.py => get_provisioned_cluster_instance.py} (75%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{delete_storage_space.py => get_vm_skus.py} (77%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{list_agent_pool_by_provisioned_cluster.py => list_agent_pool_by_provisioned_cluster_instance.py} (77%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{list_provisioned_cluster_by_resource_group.py => list_kubernetes_versions.py} (75%) delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_subscription.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{list_storage_space_by_resource_group.py => list_provisioned_cluster_instances.py} (75%) delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_subscription.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_get_upgrade_profile.py create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_admin_kubeconfig.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{provisioned_clusters_upgrade_node_image_version_for_entire_cluster.py => provisioned_cluster_instance_list_user_kubeconfig.py} (72%) delete mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_get_upgrade_profile.py rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{put_storage_space.py => put_kubernetes_versions.py} (70%) rename sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/{put_provisioned_cluster.py => put_provisioned_cluster_instance.py} (64%) create mode 100644 sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_vm_skus.py diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json index e31b587f7dae..6493f9ac99b8 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/_meta.json @@ -1,11 +1,11 @@ { - "commit": "aa85f59e259c4b12197b57b221067c40fa2fe3f1", + "commit": "2336c670d76e69d23cf17720c454820a096a458a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/hybridaks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/hybridaks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/hybridaks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_configuration.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_configuration.py index dac2a9566bec..e2e41612222a 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_configuration.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,16 +27,16 @@ class HybridContainerServiceMgmtClientConfiguration(Configuration): # pylint: d :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(HybridContainerServiceMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-01-preview"] = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_hybrid_container_service_mgmt_client.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_hybrid_container_service_mgmt_client.py index 5bb6e2fca982..79335467e293 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_hybrid_container_service_mgmt_client.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_hybrid_container_service_mgmt_client.py @@ -17,11 +17,12 @@ from ._serialization import Deserializer, Serializer from .operations import ( AgentPoolOperations, - HybridContainerServiceOperations, + HybridContainerServiceMgmtClientOperationsMixin, HybridIdentityMetadataOperations, + KubernetesVersionsOperations, Operations, - ProvisionedClustersOperations, - StorageSpacesOperations, + ProvisionedClusterInstancesOperations, + VMSkusOperations, VirtualNetworksOperations, ) @@ -30,34 +31,36 @@ from azure.core.credentials import TokenCredential -class HybridContainerServiceMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class HybridContainerServiceMgmtClient( + HybridContainerServiceMgmtClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Microsoft.HybridContainerService Rest API spec. - :ivar provisioned_clusters: ProvisionedClustersOperations operations - :vartype provisioned_clusters: - azure.mgmt.hybridcontainerservice.operations.ProvisionedClustersOperations + :ivar provisioned_cluster_instances: ProvisionedClusterInstancesOperations operations + :vartype provisioned_cluster_instances: + azure.mgmt.hybridcontainerservice.operations.ProvisionedClusterInstancesOperations :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations :vartype hybrid_identity_metadata: azure.mgmt.hybridcontainerservice.operations.HybridIdentityMetadataOperations :ivar agent_pool: AgentPoolOperations operations :vartype agent_pool: azure.mgmt.hybridcontainerservice.operations.AgentPoolOperations - :ivar hybrid_container_service: HybridContainerServiceOperations operations - :vartype hybrid_container_service: - azure.mgmt.hybridcontainerservice.operations.HybridContainerServiceOperations + :ivar kubernetes_versions: KubernetesVersionsOperations operations + :vartype kubernetes_versions: + azure.mgmt.hybridcontainerservice.operations.KubernetesVersionsOperations + :ivar vm_skus: VMSkusOperations operations + :vartype vm_skus: azure.mgmt.hybridcontainerservice.operations.VMSkusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridcontainerservice.operations.Operations - :ivar storage_spaces: StorageSpacesOperations operations - :vartype storage_spaces: azure.mgmt.hybridcontainerservice.operations.StorageSpacesOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.hybridcontainerservice.operations.VirtualNetworksOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -74,24 +77,24 @@ def __init__( self._config = HybridContainerServiceMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.provisioned_clusters = ProvisionedClustersOperations( + self.provisioned_cluster_instances = ProvisionedClusterInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) self.hybrid_identity_metadata = HybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) self.agent_pool = AgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_container_service = HybridContainerServiceOperations( + self.kubernetes_versions = KubernetesVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.vm_skus = VMSkusOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storage_spaces = StorageSpacesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_serialization.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_serialization.py index f17c068e833e..4bae2292227b 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_serialization.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_vendor.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_vendor.py index bd0df84f5319..49275efbaefc 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_vendor.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/_vendor.py @@ -5,10 +5,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast +from abc import ABC +from typing import TYPE_CHECKING from azure.core.pipeline.transport import HttpRequest +from ._configuration import HybridContainerServiceMgmtClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None @@ -18,13 +27,10 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) +class HybridContainerServiceMgmtClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: HybridContainerServiceMgmtClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_configuration.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_configuration.py index 7603f894aed3..a725ed60db0a 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_configuration.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,16 +27,16 @@ class HybridContainerServiceMgmtClientConfiguration(Configuration): # pylint: d :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(HybridContainerServiceMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-01-preview"] = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-11-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_hybrid_container_service_mgmt_client.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_hybrid_container_service_mgmt_client.py index de1d5d3bb445..87a5259a3c3d 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_hybrid_container_service_mgmt_client.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_hybrid_container_service_mgmt_client.py @@ -17,11 +17,12 @@ from ._configuration import HybridContainerServiceMgmtClientConfiguration from .operations import ( AgentPoolOperations, - HybridContainerServiceOperations, + HybridContainerServiceMgmtClientOperationsMixin, HybridIdentityMetadataOperations, + KubernetesVersionsOperations, Operations, - ProvisionedClustersOperations, - StorageSpacesOperations, + ProvisionedClusterInstancesOperations, + VMSkusOperations, VirtualNetworksOperations, ) @@ -30,35 +31,36 @@ from azure.core.credentials_async import AsyncTokenCredential -class HybridContainerServiceMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class HybridContainerServiceMgmtClient( + HybridContainerServiceMgmtClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The Microsoft.HybridContainerService Rest API spec. - :ivar provisioned_clusters: ProvisionedClustersOperations operations - :vartype provisioned_clusters: - azure.mgmt.hybridcontainerservice.aio.operations.ProvisionedClustersOperations + :ivar provisioned_cluster_instances: ProvisionedClusterInstancesOperations operations + :vartype provisioned_cluster_instances: + azure.mgmt.hybridcontainerservice.aio.operations.ProvisionedClusterInstancesOperations :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations :vartype hybrid_identity_metadata: azure.mgmt.hybridcontainerservice.aio.operations.HybridIdentityMetadataOperations :ivar agent_pool: AgentPoolOperations operations :vartype agent_pool: azure.mgmt.hybridcontainerservice.aio.operations.AgentPoolOperations - :ivar hybrid_container_service: HybridContainerServiceOperations operations - :vartype hybrid_container_service: - azure.mgmt.hybridcontainerservice.aio.operations.HybridContainerServiceOperations + :ivar kubernetes_versions: KubernetesVersionsOperations operations + :vartype kubernetes_versions: + azure.mgmt.hybridcontainerservice.aio.operations.KubernetesVersionsOperations + :ivar vm_skus: VMSkusOperations operations + :vartype vm_skus: azure.mgmt.hybridcontainerservice.aio.operations.VMSkusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hybridcontainerservice.aio.operations.Operations - :ivar storage_spaces: StorageSpacesOperations operations - :vartype storage_spaces: - azure.mgmt.hybridcontainerservice.aio.operations.StorageSpacesOperations :ivar virtual_networks: VirtualNetworksOperations operations :vartype virtual_networks: azure.mgmt.hybridcontainerservice.aio.operations.VirtualNetworksOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -75,24 +77,24 @@ def __init__( self._config = HybridContainerServiceMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.provisioned_clusters = ProvisionedClustersOperations( + self.provisioned_cluster_instances = ProvisionedClusterInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) self.hybrid_identity_metadata = HybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) self.agent_pool = AgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_container_service = HybridContainerServiceOperations( + self.kubernetes_versions = KubernetesVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.vm_skus = VMSkusOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.storage_spaces = StorageSpacesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_networks = VirtualNetworksOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_vendor.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_vendor.py new file mode 100644 index 000000000000..8949a753e975 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import HybridContainerServiceMgmtClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class HybridContainerServiceMgmtClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: HybridContainerServiceMgmtClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/__init__.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/__init__.py index 9441d9851d36..0d9ec775b10d 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/__init__.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/__init__.py @@ -6,12 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._provisioned_clusters_operations import ProvisionedClustersOperations +from ._provisioned_cluster_instances_operations import ProvisionedClusterInstancesOperations from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations from ._agent_pool_operations import AgentPoolOperations -from ._hybrid_container_service_operations import HybridContainerServiceOperations +from ._hybrid_container_service_mgmt_client_operations import HybridContainerServiceMgmtClientOperationsMixin +from ._kubernetes_versions_operations import KubernetesVersionsOperations +from ._vm_skus_operations import VMSkusOperations from ._operations import Operations -from ._storage_spaces_operations import StorageSpacesOperations from ._virtual_networks_operations import VirtualNetworksOperations from ._patch import __all__ as _patch_all @@ -19,12 +20,13 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProvisionedClustersOperations", + "ProvisionedClusterInstancesOperations", "HybridIdentityMetadataOperations", "AgentPoolOperations", - "HybridContainerServiceOperations", + "HybridContainerServiceMgmtClientOperationsMixin", + "KubernetesVersionsOperations", + "VMSkusOperations", "Operations", - "StorageSpacesOperations", "VirtualNetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_agent_pool_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_agent_pool_operations.py index 34cd068c545d..cfaa25312ee7 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_agent_pool_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_agent_pool_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -35,11 +35,8 @@ build_list_by_provisioned_cluster_request, build_update_request, ) +from .._vendor import HybridContainerServiceMgmtClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,18 +61,14 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> _models.AgentPool: - """Gets the agent pool in the provisioned cluster. + async def get(self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> _models.AgentPool: + """Gets the agent pool in the provisioned cluster instance. - Gets the agent pool in the Hybrid AKS provisioned cluster. + Gets the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -95,16 +88,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -113,8 +102,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,13 +122,12 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } async def _create_or_update_initial( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: Union[_models.AgentPool, IO], **kwargs: Any @@ -154,25 +143,21 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(agent_pool, (IO, bytes)): + if isinstance(agent_pool, (IOBase, bytes)): _content = agent_pool else: _json = self._serialize.body(agent_pool, "AgentPool") request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -184,8 +169,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,29 +193,26 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @overload async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: _models.AgentPool, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -255,23 +238,20 @@ async def begin_create_or_update( @overload async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: IO, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -297,21 +277,18 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: Union[_models.AgentPool, IO], **kwargs: Any ) -> AsyncLROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -336,9 +313,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -346,8 +321,7 @@ async def begin_create_or_update( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, agent_pool=agent_pool, api_version=api_version, @@ -384,30 +358,139 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any ) -> None: - """Deletes the agent pool in the provisioned cluster. + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - Deletes the agent pool in the Hybrid AKS provisioned cluster. + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + } + + @distributed_trace_async + async def begin_delete( + self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the agent pool in the provisioned cluster instance. + + Deletes the agent pool in the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + } + + async def _update_initial( + self, + connected_cluster_resource_uri: str, + agent_pool_name: str, + agent_pool: Union[_models.AgentPoolPatch, IO], + **kwargs: Any + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -416,99 +499,121 @@ async def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool, (IOBase, bytes)): + _content = agent_pool + else: + _json = self._serialize.body(agent_pool, "AgentPoolPatch") + + request = build_update_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + _update_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @overload - async def update( + async def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, - agent_pool: _models.AgentPool, + agent_pool: _models.AgentPoolPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> AsyncLROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str :param agent_pool: Required. - :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPoolPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> AsyncLROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -518,122 +623,117 @@ async def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO], + agent_pool: Union[_models.AgentPoolPatch, IO], **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> AsyncLROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str - :param agent_pool: Is either a AgentPool type or a IO type. Required. - :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPool or IO + :param agent_pool: Is either a AgentPoolPatch type or a IO type. Required. + :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPoolPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + agent_pool=agent_pool, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool, (IO, bytes)): - _content = agent_pool - else: - _json = self._serialize.body(agent_pool, "AgentPool") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("AgentPool", pipeline_response) - - if response.status_code == 202: + def get_long_running_output(pipeline_response): deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + begin_update.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @distributed_trace_async async def list_by_provisioned_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> _models.AgentPoolListResult: - """Gets the agent pools in the provisioned cluster. + """Gets the agent pools in the provisioned cluster instance. - Gets the agent pools in the Hybrid AKS provisioned cluster. + Gets the agent pools in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AgentPoolListResult or the result of cls(response) :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPoolListResult @@ -650,15 +750,11 @@ async def list_by_provisioned_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) request = build_list_by_provisioned_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.list_by_provisioned_cluster.metadata["url"], headers=_headers, @@ -667,8 +763,9 @@ async def list_by_provisioned_cluster( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,5 +783,5 @@ async def list_by_provisioned_cluster( return deserialized list_by_provisioned_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools" } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_mgmt_client_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_mgmt_client_operations.py new file mode 100644 index 000000000000..e6de9049aa0d --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_mgmt_client_operations.py @@ -0,0 +1,841 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._hybrid_container_service_mgmt_client_operations import ( + build_delete_kubernetes_versions_request, + build_delete_vm_skus_request, + build_get_kubernetes_versions_request, + build_get_vm_skus_request, + build_put_kubernetes_versions_request, + build_put_vm_skus_request, +) +from .._vendor import HybridContainerServiceMgmtClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HybridContainerServiceMgmtClientOperationsMixin(HybridContainerServiceMgmtClientMixinABC): + @distributed_trace_async + async def get_kubernetes_versions( + self, custom_location_resource_uri: str, **kwargs: Any + ) -> _models.KubernetesVersionProfile: + """Gets the supported kubernetes versions. + + Gets the supported kubernetes versions from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KubernetesVersionProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + + request = build_get_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.get_kubernetes_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + async def _put_kubernetes_versions_initial( + self, + custom_location_resource_uri: str, + kubernetes_versions: Union[_models.KubernetesVersionProfile, IO], + **kwargs: Any + ) -> _models.KubernetesVersionProfile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(kubernetes_versions, (IOBase, bytes)): + _content = kubernetes_versions + else: + _json = self._serialize.body(kubernetes_versions, "KubernetesVersionProfile") + + request = build_put_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_kubernetes_versions_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _put_kubernetes_versions_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @overload + async def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: _models.KubernetesVersionProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Required. + :type kubernetes_versions: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KubernetesVersionProfile or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Required. + :type kubernetes_versions: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KubernetesVersionProfile or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: Union[_models.KubernetesVersionProfile, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Is either a + KubernetesVersionProfile type or a IO type. Required. + :type kubernetes_versions: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KubernetesVersionProfile or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._put_kubernetes_versions_initial( + custom_location_resource_uri=custom_location_resource_uri, + kubernetes_versions=kubernetes_versions, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + async def _delete_kubernetes_versions_initial( # pylint: disable=inconsistent-return-statements + self, custom_location_resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self._delete_kubernetes_versions_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_kubernetes_versions_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @distributed_trace_async + async def begin_delete_kubernetes_versions( + self, custom_location_resource_uri: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the kubernetes versions. + + Delete the kubernetes versions resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_kubernetes_versions_initial( # type: ignore + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @distributed_trace_async + async def get_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> _models.VmSkuProfile: + """Gets the supported VM skus. + + Gets the supported VM skus from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmSkuProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + + request = build_get_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.get_vm_skus.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + async def _put_vm_skus_initial( + self, custom_location_resource_uri: str, skus: Union[_models.VmSkuProfile, IO], **kwargs: Any + ) -> _models.VmSkuProfile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(skus, (IOBase, bytes)): + _content = skus + else: + _json = self._serialize.body(skus, "VmSkuProfile") + + request = build_put_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_vm_skus_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _put_vm_skus_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + @overload + async def begin_put_vm_skus( + self, + custom_location_resource_uri: str, + skus: _models.VmSkuProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Required. + :type skus: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_put_vm_skus( + self, custom_location_resource_uri: str, skus: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Required. + :type skus: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_put_vm_skus( + self, custom_location_resource_uri: str, skus: Union[_models.VmSkuProfile, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Is either a VmSkuProfile type or a IO type. Required. + :type skus: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._put_vm_skus_initial( + custom_location_resource_uri=custom_location_resource_uri, + skus=skus, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + async def _delete_vm_skus_initial( # pylint: disable=inconsistent-return-statements + self, custom_location_resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self._delete_vm_skus_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_vm_skus_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + @distributed_trace_async + async def begin_delete_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the Vm Skus. + + Deletes the Vm Sku resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_vm_skus_initial( # type: ignore + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_operations.py deleted file mode 100644 index 8518b23db291..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_container_service_operations.py +++ /dev/null @@ -1,183 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._hybrid_container_service_operations import ( - build_list_orchestrators_request, - build_list_vm_skus_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class HybridContainerServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcontainerservice.aio.HybridContainerServiceMgmtClient`'s - :attr:`hybrid_container_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list_orchestrators( - self, custom_location_resource_uri: str, **kwargs: Any - ) -> _models.OrchestratorVersionProfileListResult: - """Lists the available orchestrators in a custom location. - - Lists the available orchestrators in a custom location for HybridAKS. - - :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of - the custom location resource. Required. - :type custom_location_resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OrchestratorVersionProfileListResult or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.OrchestratorVersionProfileListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OrchestratorVersionProfileListResult] = kwargs.pop("cls", None) - - request = build_list_orchestrators_request( - custom_location_resource_uri=custom_location_resource_uri, - api_version=api_version, - template_url=self.list_orchestrators.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OrchestratorVersionProfileListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_orchestrators.metadata = { - "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators" - } - - @distributed_trace_async - async def list_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> _models.VMSkuListResult: - """Lists the available VM SKUs in a custom location. - - Lists the available VM SKUs in a custom location for HybridAKS. - - :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of - the custom location resource. Required. - :type custom_location_resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VMSkuListResult or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.VMSkuListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VMSkuListResult] = kwargs.pop("cls", None) - - request = build_list_vm_skus_request( - custom_location_resource_uri=custom_location_resource_uri, - api_version=api_version, - template_url=self.list_vm_skus.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMSkuListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_vm_skus.metadata = {"url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus"} diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_identity_metadata_operations.py index 664e1c4a7ff0..d2363eb3e518 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_hybrid_identity_metadata_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,11 +21,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request @@ -35,11 +37,8 @@ build_list_by_cluster_request, build_put_request, ) +from .._vendor import HybridContainerServiceMgmtClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,9 +65,7 @@ def __init__(self, *args, **kwargs) -> None: @overload async def put( self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, + connected_cluster_resource_uri: str, body: _models.HybridIdentityMetadata, *, content_type: str = "application/json", @@ -79,14 +76,9 @@ async def put( Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Required. :type body: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -100,28 +92,16 @@ async def put( @overload async def put( - self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any + self, connected_cluster_resource_uri: str, body: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.HybridIdentityMetadata: """Creates the hybrid identity metadata resource. Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -135,26 +115,16 @@ async def put( @distributed_trace_async async def put( - self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - body: Union[_models.HybridIdentityMetadata, IO], - **kwargs: Any + self, connected_cluster_resource_uri: str, body: Union[_models.HybridIdentityMetadata, IO], **kwargs: Any ) -> _models.HybridIdentityMetadata: """Creates the hybrid identity metadata resource. Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Is either a HybridIdentityMetadata type or a IO type. Required. :type body: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -176,25 +146,20 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "HybridIdentityMetadata") request = build_put_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -206,44 +171,42 @@ async def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **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, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore put.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, hybrid_identity_metadata_resource_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: + async def get(self, connected_cluster_resource_uri: str, **kwargs: Any) -> _models.HybridIdentityMetadata: """Get the hybrid identity metadata resource. Get the hybrid identity metadata proxy resource. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HybridIdentityMetadata or the result of cls(response) :rtype: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata @@ -260,16 +223,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -278,8 +236,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,30 +256,12 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, hybrid_identity_metadata_resource_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> None: - """Deletes the hybrid identity metadata resource. - - Deletes the hybrid identity metadata proxy resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -332,55 +273,119 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace_async + async def begin_delete(self, connected_cluster_resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the hybrid identity metadata resource. + + Deletes the hybrid identity metadata proxy resource. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } @distributed_trace def list_by_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> AsyncIterable["_models.HybridIdentityMetadata"]: - """Lists the hybrid identity metadata resources in a cluster. + """Lists the hybrid identity metadata resources in a provisioned cluster instance. - Lists the hybrid identity metadata proxy resource in a cluster. + Lists the hybrid identity metadata proxy resource in a provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HybridIdentityMetadata or the result of cls(response) @@ -391,9 +396,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -408,9 +411,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_by_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.list_by_cluster.metadata["url"], headers=_headers, @@ -447,8 +448,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,5 +464,5 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata" } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_kubernetes_versions_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_kubernetes_versions_operations.py new file mode 100644 index 000000000000..5804dd6adfe1 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_kubernetes_versions_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._kubernetes_versions_operations import build_list_request +from .._vendor import HybridContainerServiceMgmtClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class KubernetesVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcontainerservice.aio.HybridContainerServiceMgmtClient`'s + :attr:`kubernetes_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, custom_location_resource_uri: str, **kwargs: Any + ) -> AsyncIterable["_models.KubernetesVersionProfile"]: + """Lists the supported kubernetes versions. + + Lists the supported kubernetes versions from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KubernetesVersionProfile or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.KubernetesVersionProfileList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("KubernetesVersionProfileList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions" + } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_operations.py index 48847d73b7ef..31771fa8cb15 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,11 +28,8 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request +from .._vendor import HybridContainerServiceMgmtClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,23 +54,20 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """list. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperation or the result of - cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +108,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -124,8 +117,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_clusters_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_cluster_instances_operations.py similarity index 53% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_clusters_operations.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_cluster_instances_operations.py index 1ba76dd5278e..50d04232a9b3 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_clusters_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_provisioned_cluster_instances_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,33 +31,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._provisioned_clusters_operations import ( +from ...operations._provisioned_cluster_instances_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_get_upgrade_profile_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, - build_upgrade_node_image_version_for_entire_cluster_request, + build_list_admin_kubeconfig_request, + build_list_request, + build_list_user_kubeconfig_request, ) +from .._vendor import HybridContainerServiceMgmtClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProvisionedClustersOperations: +class ProvisionedClusterInstancesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.hybridcontainerservice.aio.HybridContainerServiceMgmtClient`'s - :attr:`provisioned_clusters` attribute. + :attr:`provisioned_cluster_instances` attribute. """ models = _models @@ -70,21 +66,17 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ProvisionedClustersResponse: - """Gets the provisioned cluster. + async def get(self, connected_cluster_resource_uri: str, **kwargs: Any) -> _models.ProvisionedClusters: + """Gets the provisioned cluster instance. - Gets the Hybrid AKS provisioned cluster. + Gets the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProvisionedClustersResponse or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse + :return: ProvisionedClusters or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -98,15 +90,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -115,8 +103,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -126,7 +115,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -134,16 +123,15 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" } async def _create_or_update_initial( self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClusters, IO], + connected_cluster_resource_uri: str, + provisioned_cluster_instance: Union[_models.ProvisionedClusters, IO], **kwargs: Any - ) -> _models.ProvisionedClustersResponse: + ) -> _models.ProvisionedClusters: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -155,24 +143,20 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(provisioned_clusters, (IO, bytes)): - _content = provisioned_clusters + if isinstance(provisioned_cluster_instance, (IOBase, bytes)): + _content = provisioned_cluster_instance else: - _json = self._serialize.body(provisioned_clusters, "ProvisionedClusters") + _json = self._serialize.body(provisioned_cluster_instance, "ProvisionedClusters") request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -184,8 +168,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,10 +181,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,30 +192,28 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" } @overload async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: _models.ProvisionedClusters, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: _models.ProvisionedClusters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. + ) -> AsyncLROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. - Creates the Hybrid AKS provisioned cluster. + Creates the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Required. + :type provisioned_cluster_instance: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -242,34 +225,31 @@ async def begin_create_or_update( :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 ProvisionedClustersResponse or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either ProvisionedClusters or the result of + cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: IO, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. + ) -> AsyncLROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. - Creates the Hybrid AKS provisioned cluster. + Creates the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: IO + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Required. + :type provisioned_cluster_instance: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -281,32 +261,31 @@ async def begin_create_or_update( :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 ProvisionedClustersResponse or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either ProvisionedClusters or the result of + cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClusters, IO], + connected_cluster_resource_uri: str, + provisioned_cluster_instance: Union[_models.ProvisionedClusters, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. + ) -> AsyncLROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. - Creates the Hybrid AKS provisioned cluster. + Creates the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Is either a ProvisionedClusters type or a IO type. Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Is either a ProvisionedClusters type or a IO type. Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters or IO + :type provisioned_cluster_instance: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -318,28 +297,25 @@ async def begin_create_or_update( :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 ProvisionedClustersResponse or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either ProvisionedClusters or the result of + cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - provisioned_clusters=provisioned_clusters, + connected_cluster_resource_uri=connected_cluster_resource_uri, + provisioned_cluster_instance=provisioned_cluster_instance, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -350,7 +326,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -374,27 +350,12 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> None: - """Deletes the provisioned cluster. - - Deletes the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -406,215 +367,51 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - async def _update_initial( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClustersPatch, IO], - **kwargs: Any - ) -> _models.ProvisionedClustersResponse: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(provisioned_clusters, (IO, bytes)): - _content = provisioned_clusters - else: - _json = self._serialize.body(provisioned_clusters, "ProvisionedClustersPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - + response_headers = {} if response.status_code == 202: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, response_headers) - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" } - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: _models.ProvisionedClustersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. - - Updates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProvisionedClustersResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. - - Updates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ProvisionedClustersResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClustersPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. + async def begin_delete(self, connected_cluster_resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the provisioned cluster instance. - Updates the Hybrid AKS provisioned cluster. + Deletes the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Is either a ProvisionedClustersPatch type or a IO type. Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersPatch - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -623,30 +420,22 @@ async def begin_update( :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 ProvisionedClustersResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - provisioned_clusters=provisioned_clusters, + raw_result = await self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -654,11 +443,9 @@ async def begin_update( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + return cls(pipeline_response, None, {}) if polling is True: polling_method: AsyncPollingMethod = cast( @@ -678,35 +465,30 @@ def get_long_running_output(pipeline_response): ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" } @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProvisionedClustersResponse"]: - """Gets the provisioned clusters in a resource group. + def list(self, connected_cluster_resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.ProvisionedClusters"]: + """Gets the provisioned cluster instances associated with the connected cluster. - Gets the Hybrid AKS provisioned cluster in a resource group. + Gets the Hybrid AKS provisioned cluster instances associated with the connected cluster. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProvisionedClustersResponse or the result of - cls(response) + :return: An iterator like instance of either ProvisionedClusters or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponseListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClustersListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -719,11 +501,10 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, + request = build_list_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -749,7 +530,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponseListResult", pipeline_response) + deserialized = self._deserialize("ProvisionedClustersListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -758,8 +539,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -772,31 +554,26 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters" + list.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances" } - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ProvisionedClustersResponse"]: - """Gets the provisioned clusters in a subscription. + @distributed_trace_async + async def get_upgrade_profile( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> _models.ProvisionedClusterUpgradeProfile: + """Gets the upgrade profile of a provisioned cluster instance. - Gets the Hybrid AKS provisioned cluster in a subscription. + Gets the upgrade profile of a provisioned cluster instance. + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProvisionedClustersResponse or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] + :return: ProvisionedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterUpgradeProfile :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponseListResult] = kwargs.pop("cls", None) - error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -805,83 +582,48 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Provisio } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClusterUpgradeProfile] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + request = build_get_upgrade_profile_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponseListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - request = prepare_request(next_link) + response = pipeline_response.http_response - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize("ProvisionedClusterUpgradeProfile", pipeline_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) - return AsyncItemPaged(get_next, extract_data) + return deserialized - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters" + get_upgrade_profile.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default" } - @distributed_trace_async - async def get_upgrade_profile( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ProvisionedClusterUpgradeProfile: - """Gets the upgrade profile of a provisioned cluster. - - Gets the upgrade profile of a provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProvisionedClusterUpgradeProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterUpgradeProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _list_user_kubeconfig_initial( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> Optional[_models.ListCredentialResponse]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -893,48 +635,123 @@ async def get_upgrade_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClusterUpgradeProfile] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ListCredentialResponse]] = kwargs.pop("cls", None) - request = build_get_upgrade_profile_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + request = build_list_user_kubeconfig_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - template_url=self.get_upgrade_profile.metadata["url"], + template_url=self._list_user_kubeconfig_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProvisionedClusterUpgradeProfile", pipeline_response) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized - get_upgrade_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeProfiles/default" + _list_user_kubeconfig_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" } - async def _upgrade_node_image_version_for_entire_cluster_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: + @distributed_trace_async + async def begin_list_user_kubeconfig( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ListCredentialResponse]: + """Listing the AAD user credentials of a provisioned cluster instance used only in direct mode. + + Lists the AAD user credentials of a provisioned cluster instance used only in direct mode. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ListCredentialResponse or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ListCredentialResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCredentialResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._list_user_kubeconfig_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_user_kubeconfig.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" + } + + async def _list_admin_kubeconfig_initial( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> Optional[_models.ListCredentialResponse]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -946,25 +763,22 @@ async def _upgrade_node_image_version_for_entire_cluster_initial( # pylint: dis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ListCredentialResponse]] = kwargs.pop("cls", None) - request = build_upgrade_node_image_version_for_entire_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + request = build_list_admin_kubeconfig_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - template_url=self._upgrade_node_image_version_for_entire_cluster_initial.metadata["url"], + template_url=self._list_admin_kubeconfig_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -974,27 +788,34 @@ async def _upgrade_node_image_version_for_entire_cluster_initial( # pylint: dis error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) + + return deserialized - _upgrade_node_image_version_for_entire_cluster_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster" + _list_admin_kubeconfig_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" } @distributed_trace_async - async def begin_upgrade_node_image_version_for_entire_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrades the node image version of the cluster control plane and all agent pools to the latest. + async def begin_list_admin_kubeconfig( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ListCredentialResponse]: + """Listing the admin credentials of a provisioned cluster instance used only in direct mode. - Upgrading the node image version of a cluster applies the newest OS and runtime updates to the - nodes. + Lists the admin credentials of a provisioned cluster instance used only in direct mode. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1003,24 +824,23 @@ async def begin_upgrade_node_image_version_for_entire_cluster( :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] + :return: An instance of AsyncLROPoller that returns either ListCredentialResponse or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.ListCredentialResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCredentialResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._upgrade_node_image_version_for_entire_cluster_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, + raw_result = await self._list_admin_kubeconfig_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1029,13 +849,16 @@ async def begin_upgrade_node_image_version_for_entire_cluster( ) kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -1050,6 +873,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_upgrade_node_image_version_for_entire_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster" + begin_list_admin_kubeconfig.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_storage_spaces_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_storage_spaces_operations.py deleted file mode 100644 index a610a47be105..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_storage_spaces_operations.py +++ /dev/null @@ -1,858 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._storage_spaces_operations import ( - build_create_or_update_request, - build_delete_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_retrieve_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class StorageSpacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcontainerservice.aio.HybridContainerServiceMgmtClient`'s - :attr:`storage_spaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def retrieve( - self, resource_group_name: str, storage_spaces_name: str, **kwargs: Any - ) -> _models.StorageSpaces: - """Gets the storage space object. - - Gets the Hybrid AKS storage space object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageSpaces or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - async def _create_or_update_initial( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpaces, IO], - **kwargs: Any - ) -> _models.StorageSpaces: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_spaces, (IO, bytes)): - _content = storage_spaces - else: - _json = self._serialize.body(storage_spaces, "StorageSpaces") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: _models.StorageSpaces, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpaces, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Is either a StorageSpaces type or a IO type. Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - storage_spaces=storage_spaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSpaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storage_spaces_name: str, **kwargs: Any - ) -> None: - """Deletes the storage object. - - Deletes the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - async def _update_initial( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpacesPatch, IO], - **kwargs: Any - ) -> _models.StorageSpaces: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_spaces, (IO, bytes)): - _content = storage_spaces - else: - _json = self._serialize.body(storage_spaces, "StorageSpacesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: _models.StorageSpacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpacesPatch, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Is either a StorageSpacesPatch type or a IO type. Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - storage_spaces=storage_spaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSpaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.StorageSpaces"]: - """List the storage object by resource group. - - List the Hybrid AKS storage object by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSpaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpacesListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSpacesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StorageSpaces"]: - """List the storage object by subscription. - - List the Hybrid AKS storage object by subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSpaces or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpacesListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSpacesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces" - } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_virtual_networks_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_virtual_networks_operations.py index d5dfa8bd7ae2..84b577a2f734 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_virtual_networks_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,11 +39,8 @@ build_retrieve_request, build_update_request, ) +from .._vendor import HybridContainerServiceMgmtClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,8 +66,8 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def retrieve( - self, resource_group_name: str, virtual_networks_name: str, **kwargs: Any - ) -> _models.VirtualNetworks: + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> _models.VirtualNetwork: """Gets the virtual network. Gets the Hybrid AKS virtual network. @@ -78,11 +75,11 @@ async def retrieve( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworks or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -96,14 +93,12 @@ async def retrieve( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_retrieve_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.retrieve.metadata["url"], @@ -113,8 +108,9 @@ async def retrieve( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -124,7 +120,7 @@ async def retrieve( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -132,16 +128,16 @@ async def retrieve( return deserialized retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } async def _create_or_update_initial( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: Union[_models.VirtualNetworks, IO], + virtual_network_name: str, + virtual_networks: Union[_models.VirtualNetwork, IO], **kwargs: Any - ) -> _models.VirtualNetworks: + ) -> _models.VirtualNetwork: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -153,23 +149,21 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_networks, (IO, bytes)): + if isinstance(virtual_networks, (IOBase, bytes)): _content = virtual_networks else: - _json = self._serialize.body(virtual_networks, "VirtualNetworks") + _json = self._serialize.body(virtual_networks, "VirtualNetwork") request = build_create_or_update_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -182,8 +176,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,10 +189,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -205,19 +200,19 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @overload async def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: _models.VirtualNetworks, + virtual_network_name: str, + virtual_networks: _models.VirtualNetwork, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -225,10 +220,10 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. - :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks + :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -240,10 +235,10 @@ async def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -251,12 +246,12 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -264,8 +259,8 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -279,10 +274,10 @@ async def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -290,10 +285,10 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: Union[_models.VirtualNetworks, IO], + virtual_network_name: str, + virtual_networks: Union[_models.VirtualNetwork, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -301,10 +296,10 @@ async def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str - :param virtual_networks: Is either a VirtualNetworks type or a IO type. Required. - :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks or IO + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_networks: Is either a VirtualNetwork type or a IO type. Required. + :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -316,27 +311,25 @@ async def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, virtual_networks=virtual_networks, api_version=api_version, content_type=content_type, @@ -348,7 +341,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -372,27 +365,12 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_networks_name: str, **kwargs: Any + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any ) -> None: - """Deletes the virtual network. - - Deletes the Hybrid AKS virtual network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -404,48 +382,122 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the virtual network. + + Deletes the Hybrid AKS virtual network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } async def _update_initial( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: Union[_models.VirtualNetworksPatch, IO], **kwargs: Any - ) -> _models.VirtualNetworks: + ) -> Optional[_models.VirtualNetwork]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -457,23 +509,21 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualNetwork]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_networks, (IO, bytes)): + if isinstance(virtual_networks, (IOBase, bytes)): _content = virtual_networks else: _json = self._serialize.body(virtual_networks, "VirtualNetworksPatch") request = build_update_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -486,8 +536,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,31 +548,33 @@ async def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @overload async def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: _models.VirtualNetworksPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -529,8 +582,8 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -544,10 +597,10 @@ async def begin_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -555,12 +608,12 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -568,8 +621,8 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -583,10 +636,10 @@ async def begin_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -594,10 +647,10 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: Union[_models.VirtualNetworksPatch, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualNetworks]: + ) -> AsyncLROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -605,8 +658,8 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Is either a VirtualNetworksPatch type or a IO type. Required. :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -620,27 +673,25 @@ async def begin_update( :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 VirtualNetworks or the result of + :return: An instance of AsyncLROPoller that returns either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, virtual_networks=virtual_networks, api_version=api_version, content_type=content_type, @@ -652,7 +703,7 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -676,13 +727,13 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualNetworks"]: + ) -> AsyncIterable["_models.VirtualNetwork"]: """List virtual networks by resource group. Lists the Hybrid AKS virtual networks by resource group. @@ -691,17 +742,15 @@ def list_by_resource_group( Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworks or the result of cls(response) + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksListResult] = kwargs.pop("cls", None) error_map = { @@ -754,8 +803,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,23 +823,21 @@ async def get_next(next_link=None): } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetworks"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: """List virtual networks by subscription. Lists the Hybrid AKS virtual networks by subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworks or the result of cls(response) + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksListResult] = kwargs.pop("cls", None) error_map = { @@ -841,8 +889,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_vm_skus_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_vm_skus_operations.py new file mode 100644 index 000000000000..d7c182387670 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/aio/operations/_vm_skus_operations.py @@ -0,0 +1,141 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._vm_skus_operations import build_list_request +from .._vendor import HybridContainerServiceMgmtClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VMSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcontainerservice.aio.HybridContainerServiceMgmtClient`'s + :attr:`vm_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, custom_location_resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VmSkuProfile"]: + """Lists the supported VM SKUs. + + Lists the supported VM SKUs from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmSkuProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmSkuProfileList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VmSkuProfileList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus"} diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/__init__.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/__init__.py index 15947a97e2c4..31499b41730f 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/__init__.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/__init__.py @@ -6,226 +6,186 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AADProfile -from ._models_py3 import AADProfileResponse -from ._models_py3 import AADProfileSecret -from ._models_py3 import AddonProfiles -from ._models_py3 import AddonStatus +from ._models_py3 import AddonStatusProfile from ._models_py3 import AgentPool -from ._models_py3 import AgentPoolExtendedLocation from ._models_py3 import AgentPoolListResult from ._models_py3 import AgentPoolName +from ._models_py3 import AgentPoolPatch from ._models_py3 import AgentPoolProfile from ._models_py3 import AgentPoolProperties from ._models_py3 import AgentPoolProvisioningStatus -from ._models_py3 import AgentPoolProvisioningStatusError +from ._models_py3 import AgentPoolProvisioningStatusOperationStatus +from ._models_py3 import AgentPoolProvisioningStatusOperationStatusError from ._models_py3 import AgentPoolProvisioningStatusStatus -from ._models_py3 import AgentPoolProvisioningStatusStatusProvisioningStatus -from ._models_py3 import ArcAgentProfile -from ._models_py3 import ArcAgentStatus +from ._models_py3 import AgentPoolUpdateProfile from ._models_py3 import CloudProviderProfile from ._models_py3 import CloudProviderProfileInfraNetworkProfile -from ._models_py3 import CloudProviderProfileInfraStorageProfile from ._models_py3 import ControlPlaneEndpointProfile from ._models_py3 import ControlPlaneEndpointProfileControlPlaneEndpoint from ._models_py3 import ControlPlaneProfile +from ._models_py3 import CredentialResult from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse -from ._models_py3 import HttpProxyConfig -from ._models_py3 import HttpProxyConfigPassword -from ._models_py3 import HttpProxyConfigResponse +from ._models_py3 import ExtendedLocation from ._models_py3 import HybridIdentityMetadata from ._models_py3 import HybridIdentityMetadataList +from ._models_py3 import KubernetesPatchVersions +from ._models_py3 import KubernetesVersionCapabilities +from ._models_py3 import KubernetesVersionProfile +from ._models_py3 import KubernetesVersionProfileList +from ._models_py3 import KubernetesVersionProfileProperties +from ._models_py3 import KubernetesVersionProperties +from ._models_py3 import KubernetesVersionReadiness from ._models_py3 import LinuxProfile from ._models_py3 import LinuxProfileProperties from ._models_py3 import LinuxProfilePropertiesSsh from ._models_py3 import LinuxProfilePropertiesSshPublicKeysItem -from ._models_py3 import LoadBalancerProfile +from ._models_py3 import ListCredentialResponse +from ._models_py3 import ListCredentialResponseError +from ._models_py3 import ListCredentialResponseProperties from ._models_py3 import NamedAgentPoolProfile from ._models_py3 import NetworkProfile -from ._models_py3 import OrchestratorProfile -from ._models_py3 import OrchestratorVersionProfile -from ._models_py3 import OrchestratorVersionProfileListResult -from ._models_py3 import ProvisionedClusterIdentity +from ._models_py3 import NetworkProfileLoadBalancerProfile +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import ProvisionedClusterLicenseProfile from ._models_py3 import ProvisionedClusterPoolUpgradeProfile from ._models_py3 import ProvisionedClusterPoolUpgradeProfileProperties +from ._models_py3 import ProvisionedClusterProperties +from ._models_py3 import ProvisionedClusterPropertiesStatus +from ._models_py3 import ProvisionedClusterPropertiesStatusOperationStatus +from ._models_py3 import ProvisionedClusterPropertiesStatusOperationStatusError from ._models_py3 import ProvisionedClusterUpgradeProfile from ._models_py3 import ProvisionedClusters -from ._models_py3 import ProvisionedClustersAllProperties -from ._models_py3 import ProvisionedClustersCommonProperties -from ._models_py3 import ProvisionedClustersCommonPropertiesFeatures -from ._models_py3 import ProvisionedClustersCommonPropertiesStatus -from ._models_py3 import ProvisionedClustersCommonPropertiesStatusFeaturesStatus -from ._models_py3 import ProvisionedClustersCommonPropertiesStatusProvisioningStatus -from ._models_py3 import ProvisionedClustersCommonPropertiesStatusProvisioningStatusError -from ._models_py3 import ProvisionedClustersExtendedLocation -from ._models_py3 import ProvisionedClustersPatch -from ._models_py3 import ProvisionedClustersPropertiesWithSecrets -from ._models_py3 import ProvisionedClustersPropertiesWithoutSecrets -from ._models_py3 import ProvisionedClustersResponse -from ._models_py3 import ProvisionedClustersResponseExtendedLocation -from ._models_py3 import ProvisionedClustersResponseListResult -from ._models_py3 import ProvisionedClustersResponseProperties +from ._models_py3 import ProvisionedClustersListResult 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 StorageSpaces -from ._models_py3 import StorageSpacesExtendedLocation -from ._models_py3 import StorageSpacesListResult -from ._models_py3 import StorageSpacesPatch -from ._models_py3 import StorageSpacesProperties -from ._models_py3 import StorageSpacesPropertiesHciStorageProfile -from ._models_py3 import StorageSpacesPropertiesStatus -from ._models_py3 import StorageSpacesPropertiesStatusProvisioningStatus -from ._models_py3 import StorageSpacesPropertiesStatusProvisioningStatusError -from ._models_py3 import StorageSpacesPropertiesVmwareStorageProfile from ._models_py3 import SystemData from ._models_py3 import TrackedResource -from ._models_py3 import VMSkuListResult -from ._models_py3 import VirtualNetworks -from ._models_py3 import VirtualNetworksExtendedLocation +from ._models_py3 import VirtualNetwork +from ._models_py3 import VirtualNetworkExtendedLocation +from ._models_py3 import VirtualNetworkProperties +from ._models_py3 import VirtualNetworkPropertiesInfraVnetProfile +from ._models_py3 import VirtualNetworkPropertiesInfraVnetProfileHci +from ._models_py3 import VirtualNetworkPropertiesInfraVnetProfileVmware +from ._models_py3 import VirtualNetworkPropertiesStatus +from ._models_py3 import VirtualNetworkPropertiesStatusOperationStatus +from ._models_py3 import VirtualNetworkPropertiesStatusOperationStatusError +from ._models_py3 import VirtualNetworkPropertiesVipPoolItem +from ._models_py3 import VirtualNetworkPropertiesVmipPoolItem from ._models_py3 import VirtualNetworksListResult from ._models_py3 import VirtualNetworksPatch -from ._models_py3 import VirtualNetworksProperties -from ._models_py3 import VirtualNetworksPropertiesInfraVnetProfile -from ._models_py3 import VirtualNetworksPropertiesInfraVnetProfileHci -from ._models_py3 import VirtualNetworksPropertiesInfraVnetProfileNetworkCloud -from ._models_py3 import VirtualNetworksPropertiesInfraVnetProfileVmware -from ._models_py3 import VirtualNetworksPropertiesStatus -from ._models_py3 import VirtualNetworksPropertiesStatusProvisioningStatus -from ._models_py3 import VirtualNetworksPropertiesStatusProvisioningStatusError -from ._models_py3 import VirtualNetworksPropertiesVipPoolItem -from ._models_py3 import VirtualNetworksPropertiesVmipPoolItem -from ._models_py3 import WindowsProfile -from ._models_py3 import WindowsProfilePassword -from ._models_py3 import WindowsProfileResponse +from ._models_py3 import VmSkuCapabilities +from ._models_py3 import VmSkuProfile +from ._models_py3 import VmSkuProfileList +from ._models_py3 import VmSkuProfileProperties +from ._models_py3 import VmSkuProperties -from ._hybrid_container_service_mgmt_client_enums import AgentPoolProvisioningState -from ._hybrid_container_service_mgmt_client_enums import AutoUpgradeOptions +from ._hybrid_container_service_mgmt_client_enums import ActionType +from ._hybrid_container_service_mgmt_client_enums import AddonPhase +from ._hybrid_container_service_mgmt_client_enums import AzureHybridBenefit from ._hybrid_container_service_mgmt_client_enums import CreatedByType -from ._hybrid_container_service_mgmt_client_enums import DeploymentState -from ._hybrid_container_service_mgmt_client_enums import LicenseType -from ._hybrid_container_service_mgmt_client_enums import LoadBalancerSku -from ._hybrid_container_service_mgmt_client_enums import Mode +from ._hybrid_container_service_mgmt_client_enums import ExtendedLocationTypes from ._hybrid_container_service_mgmt_client_enums import NetworkPolicy +from ._hybrid_container_service_mgmt_client_enums import OSSKU +from ._hybrid_container_service_mgmt_client_enums import Origin from ._hybrid_container_service_mgmt_client_enums import OsType from ._hybrid_container_service_mgmt_client_enums import ProvisioningState -from ._hybrid_container_service_mgmt_client_enums import ResourceIdentityType +from ._hybrid_container_service_mgmt_client_enums import ResourceProvisioningState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AADProfile", - "AADProfileResponse", - "AADProfileSecret", - "AddonProfiles", - "AddonStatus", + "AddonStatusProfile", "AgentPool", - "AgentPoolExtendedLocation", "AgentPoolListResult", "AgentPoolName", + "AgentPoolPatch", "AgentPoolProfile", "AgentPoolProperties", "AgentPoolProvisioningStatus", - "AgentPoolProvisioningStatusError", + "AgentPoolProvisioningStatusOperationStatus", + "AgentPoolProvisioningStatusOperationStatusError", "AgentPoolProvisioningStatusStatus", - "AgentPoolProvisioningStatusStatusProvisioningStatus", - "ArcAgentProfile", - "ArcAgentStatus", + "AgentPoolUpdateProfile", "CloudProviderProfile", "CloudProviderProfileInfraNetworkProfile", - "CloudProviderProfileInfraStorageProfile", "ControlPlaneEndpointProfile", "ControlPlaneEndpointProfileControlPlaneEndpoint", "ControlPlaneProfile", + "CredentialResult", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", - "HttpProxyConfig", - "HttpProxyConfigPassword", - "HttpProxyConfigResponse", + "ExtendedLocation", "HybridIdentityMetadata", "HybridIdentityMetadataList", + "KubernetesPatchVersions", + "KubernetesVersionCapabilities", + "KubernetesVersionProfile", + "KubernetesVersionProfileList", + "KubernetesVersionProfileProperties", + "KubernetesVersionProperties", + "KubernetesVersionReadiness", "LinuxProfile", "LinuxProfileProperties", "LinuxProfilePropertiesSsh", "LinuxProfilePropertiesSshPublicKeysItem", - "LoadBalancerProfile", + "ListCredentialResponse", + "ListCredentialResponseError", + "ListCredentialResponseProperties", "NamedAgentPoolProfile", "NetworkProfile", - "OrchestratorProfile", - "OrchestratorVersionProfile", - "OrchestratorVersionProfileListResult", - "ProvisionedClusterIdentity", + "NetworkProfileLoadBalancerProfile", + "Operation", + "OperationDisplay", + "OperationListResult", + "ProvisionedClusterLicenseProfile", "ProvisionedClusterPoolUpgradeProfile", "ProvisionedClusterPoolUpgradeProfileProperties", + "ProvisionedClusterProperties", + "ProvisionedClusterPropertiesStatus", + "ProvisionedClusterPropertiesStatusOperationStatus", + "ProvisionedClusterPropertiesStatusOperationStatusError", "ProvisionedClusterUpgradeProfile", "ProvisionedClusters", - "ProvisionedClustersAllProperties", - "ProvisionedClustersCommonProperties", - "ProvisionedClustersCommonPropertiesFeatures", - "ProvisionedClustersCommonPropertiesStatus", - "ProvisionedClustersCommonPropertiesStatusFeaturesStatus", - "ProvisionedClustersCommonPropertiesStatusProvisioningStatus", - "ProvisionedClustersCommonPropertiesStatusProvisioningStatusError", - "ProvisionedClustersExtendedLocation", - "ProvisionedClustersPatch", - "ProvisionedClustersPropertiesWithSecrets", - "ProvisionedClustersPropertiesWithoutSecrets", - "ProvisionedClustersResponse", - "ProvisionedClustersResponseExtendedLocation", - "ProvisionedClustersResponseListResult", - "ProvisionedClustersResponseProperties", + "ProvisionedClustersListResult", "ProxyResource", "Resource", - "ResourceProviderOperation", - "ResourceProviderOperationDisplay", - "ResourceProviderOperationList", - "StorageSpaces", - "StorageSpacesExtendedLocation", - "StorageSpacesListResult", - "StorageSpacesPatch", - "StorageSpacesProperties", - "StorageSpacesPropertiesHciStorageProfile", - "StorageSpacesPropertiesStatus", - "StorageSpacesPropertiesStatusProvisioningStatus", - "StorageSpacesPropertiesStatusProvisioningStatusError", - "StorageSpacesPropertiesVmwareStorageProfile", "SystemData", "TrackedResource", - "VMSkuListResult", - "VirtualNetworks", - "VirtualNetworksExtendedLocation", + "VirtualNetwork", + "VirtualNetworkExtendedLocation", + "VirtualNetworkProperties", + "VirtualNetworkPropertiesInfraVnetProfile", + "VirtualNetworkPropertiesInfraVnetProfileHci", + "VirtualNetworkPropertiesInfraVnetProfileVmware", + "VirtualNetworkPropertiesStatus", + "VirtualNetworkPropertiesStatusOperationStatus", + "VirtualNetworkPropertiesStatusOperationStatusError", + "VirtualNetworkPropertiesVipPoolItem", + "VirtualNetworkPropertiesVmipPoolItem", "VirtualNetworksListResult", "VirtualNetworksPatch", - "VirtualNetworksProperties", - "VirtualNetworksPropertiesInfraVnetProfile", - "VirtualNetworksPropertiesInfraVnetProfileHci", - "VirtualNetworksPropertiesInfraVnetProfileNetworkCloud", - "VirtualNetworksPropertiesInfraVnetProfileVmware", - "VirtualNetworksPropertiesStatus", - "VirtualNetworksPropertiesStatusProvisioningStatus", - "VirtualNetworksPropertiesStatusProvisioningStatusError", - "VirtualNetworksPropertiesVipPoolItem", - "VirtualNetworksPropertiesVmipPoolItem", - "WindowsProfile", - "WindowsProfilePassword", - "WindowsProfileResponse", - "AgentPoolProvisioningState", - "AutoUpgradeOptions", + "VmSkuCapabilities", + "VmSkuProfile", + "VmSkuProfileList", + "VmSkuProfileProperties", + "VmSkuProperties", + "ActionType", + "AddonPhase", + "AzureHybridBenefit", "CreatedByType", - "DeploymentState", - "LicenseType", - "LoadBalancerSku", - "Mode", + "ExtendedLocationTypes", "NetworkPolicy", + "OSSKU", + "Origin", "OsType", "ProvisioningState", - "ResourceIdentityType", + "ResourceProvisioningState", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_hybrid_container_service_mgmt_client_enums.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_hybrid_container_service_mgmt_client_enums.py index 4729c872e4cc..560f35078dda 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_hybrid_container_service_mgmt_client_enums.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_hybrid_container_service_mgmt_client_enums.py @@ -10,76 +10,49 @@ from azure.core import CaseInsensitiveEnumMeta -class AgentPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AgentPoolProvisioningState.""" +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - IN_PROGRESS = "InProgress" - CANCELED = "Canceled" - - -class AutoUpgradeOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the Arc agents on the provisioned clusters be upgraded automatically to the - latest version. Defaults to Enabled. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" + INTERNAL = "Internal" -class DeploymentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Observed deployment state of the Arc Agents on the target cluster. Possible values include: - 'pending', 'provisioning', 'provisioned', 'deleting', 'failed', 'upgrading'. +class AddonPhase(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Observed phase of the addon on the target cluster. Possible values include: 'pending', + 'provisioning', 'provisioning {HelmChartInstalled}', 'provisioning {MSICertificateDownloaded}', + 'provisioned', 'deleting', 'failed', 'upgrading'. """ PENDING = "pending" PROVISIONING = "provisioning" + PROVISIONING_HELM_CHART_INSTALLED_ = "provisioning {HelmChartInstalled}" + PROVISIONING_MSI_CERTIFICATE_DOWNLOADED_ = "provisioning {MSICertificateDownloaded}" PROVISIONED = "provisioned" DELETING = "deleting" FAILED = "failed" UPGRADING = "upgrading" -class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """LicenseType - The licenseType to use for Windows VMs. Windows_Server is used to enable Azure - Hybrid User Benefits for Windows VMs. Possible values include: 'None', 'Windows_Server'. - """ +class AzureHybridBenefit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether Azure Hybrid Benefit is opted in.""" - WINDOWS_SERVER = "Windows_Server" - NONE = "None" + TRUE = "True" + FALSE = "False" + NOT_APPLICABLE = "NotApplicable" -class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """LoadBalancerSku - The load balancer sku for the provisioned cluster. Possible values: - 'unstacked-haproxy', 'stacked-kube-vip', 'stacked-metallb', 'unmanaged'. The default is - 'unmanaged'. - """ +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" - UNSTACKED_HAPROXY = "unstacked-haproxy" - STACKED_KUBE_VIP = "stacked-kube-vip" - STACKED_METALLB = "stacked-metallb" - UNMANAGED = "unmanaged" + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" -class Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Mode - AgentPoolMode represents mode of an agent pool. Possible values include: 'System', 'LB', - 'User'. Default is 'User'. - """ +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The extended location type.""" - SYSTEM = "System" - LB = "LB" - USER = "User" + CUSTOM_LOCATION = "CustomLocation" class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -91,13 +64,34 @@ class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): FLANNEL = "flannel" -class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OsType - OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. - Possible values include: 'Linux', 'Windows'. +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". """ - LINUX = "Linux" + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType is Linux. The + default is Windows2019 when OSType is Windows. + """ + + CBL_MARINER = "CBLMariner" + """Use Mariner as the OS for node images.""" + WINDOWS2019 = "Windows2019" + """Use Windows2019 as the OS for node images.""" + WINDOWS2022 = "Windows2022" + """Use Windows2022 as the OS for node images.""" + + +class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The particular KubernetesVersion's Image's OS Type (Linux, Windows).""" + WINDOWS = "Windows" + LINUX = "Linux" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -113,11 +107,16 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CREATED = "Created" -class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity used for the provisioned cluster. The type SystemAssigned, includes a - system created identity. The type None means no identity is assigned to the provisioned - cluster. - """ +class ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the resource.""" - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + UPDATING = "Updating" + UPGRADING = "Upgrading" + IN_PROGRESS = "InProgress" + ACCEPTED = "Accepted" + CREATED = "Created" diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_models_py3.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_models_py3.py index fee263ad6516..97c9fc6858a4 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_models_py3.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/models/_models_py3.py @@ -8,250 +8,73 @@ # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -class AADProfileResponse(_serialization.Model): - """AAD Profile specifies attributes for Azure Active Directory integration. - - :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of - the cluster. - :vartype admin_group_object_i_ds: list[str] - :ivar client_app_id: The client AAD application ID. - :vartype client_app_id: str - :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. - :vartype enable_azure_rbac: bool - :ivar managed: Whether to enable managed AAD. - :vartype managed: bool - :ivar server_app_id: The server AAD application ID. - :vartype server_app_id: str - :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the - tenant of the deployment subscription. - :vartype tenant_id: str - """ - - _attribute_map = { - "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, - "client_app_id": {"key": "clientAppID", "type": "str"}, - "enable_azure_rbac": {"key": "enableAzureRbac", "type": "bool"}, - "managed": {"key": "managed", "type": "bool"}, - "server_app_id": {"key": "serverAppID", "type": "str"}, - "tenant_id": {"key": "tenantID", "type": "str"}, - } - - def __init__( - self, - *, - admin_group_object_i_ds: Optional[List[str]] = None, - client_app_id: Optional[str] = None, - enable_azure_rbac: Optional[bool] = None, - managed: Optional[bool] = None, - server_app_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of - the cluster. - :paramtype admin_group_object_i_ds: list[str] - :keyword client_app_id: The client AAD application ID. - :paramtype client_app_id: str - :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. - :paramtype enable_azure_rbac: bool - :keyword managed: Whether to enable managed AAD. - :paramtype managed: bool - :keyword server_app_id: The server AAD application ID. - :paramtype server_app_id: str - :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the - tenant of the deployment subscription. - :paramtype tenant_id: str - """ - super().__init__(**kwargs) - self.admin_group_object_i_ds = admin_group_object_i_ds - self.client_app_id = client_app_id - self.enable_azure_rbac = enable_azure_rbac - self.managed = managed - self.server_app_id = server_app_id - self.tenant_id = tenant_id - - -class AADProfileSecret(_serialization.Model): - """The server AAD application secret. - - :ivar server_app_secret: The server AAD application secret. - :vartype server_app_secret: str - """ - - _attribute_map = { - "server_app_secret": {"key": "serverAppSecret", "type": "str"}, - } - - def __init__(self, *, server_app_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword server_app_secret: The server AAD application secret. - :paramtype server_app_secret: str - """ - super().__init__(**kwargs) - self.server_app_secret = server_app_secret - - -class AADProfile(AADProfileSecret, AADProfileResponse): - """AAD Profile specifies attributes for Azure Active Directory integration. - - :ivar admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of - the cluster. - :vartype admin_group_object_i_ds: list[str] - :ivar client_app_id: The client AAD application ID. - :vartype client_app_id: str - :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. - :vartype enable_azure_rbac: bool - :ivar managed: Whether to enable managed AAD. - :vartype managed: bool - :ivar server_app_id: The server AAD application ID. - :vartype server_app_id: str - :ivar tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the - tenant of the deployment subscription. - :vartype tenant_id: str - :ivar server_app_secret: The server AAD application secret. - :vartype server_app_secret: str - """ - - _attribute_map = { - "admin_group_object_i_ds": {"key": "adminGroupObjectIDs", "type": "[str]"}, - "client_app_id": {"key": "clientAppID", "type": "str"}, - "enable_azure_rbac": {"key": "enableAzureRbac", "type": "bool"}, - "managed": {"key": "managed", "type": "bool"}, - "server_app_id": {"key": "serverAppID", "type": "str"}, - "tenant_id": {"key": "tenantID", "type": "str"}, - "server_app_secret": {"key": "serverAppSecret", "type": "str"}, - } - - def __init__( - self, - *, - admin_group_object_i_ds: Optional[List[str]] = None, - client_app_id: Optional[str] = None, - enable_azure_rbac: Optional[bool] = None, - managed: Optional[bool] = None, - server_app_id: Optional[str] = None, - tenant_id: Optional[str] = None, - server_app_secret: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword admin_group_object_i_ds: The list of AAD group object IDs that will have admin role of - the cluster. - :paramtype admin_group_object_i_ds: list[str] - :keyword client_app_id: The client AAD application ID. - :paramtype client_app_id: str - :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. - :paramtype enable_azure_rbac: bool - :keyword managed: Whether to enable managed AAD. - :paramtype managed: bool - :keyword server_app_id: The server AAD application ID. - :paramtype server_app_id: str - :keyword tenant_id: The AAD tenant ID to use for authentication. If not specified, will use the - tenant of the deployment subscription. - :paramtype tenant_id: str - :keyword server_app_secret: The server AAD application secret. - :paramtype server_app_secret: str - """ - super().__init__( - server_app_secret=server_app_secret, - admin_group_object_i_ds=admin_group_object_i_ds, - client_app_id=client_app_id, - enable_azure_rbac=enable_azure_rbac, - managed=managed, - server_app_id=server_app_id, - tenant_id=tenant_id, - **kwargs - ) - self.admin_group_object_i_ds = admin_group_object_i_ds - self.client_app_id = client_app_id - self.enable_azure_rbac = enable_azure_rbac - self.managed = managed - self.server_app_id = server_app_id - self.tenant_id = tenant_id - self.server_app_secret = server_app_secret - - -class AddonProfiles(_serialization.Model): - """Addon configurations. - - :ivar config: Config - Key-value pairs for configuring an add-on. - :vartype config: dict[str, str] - :ivar enabled: Enabled - Whether the add-on is enabled or not. - :vartype enabled: bool - """ - - _attribute_map = { - "config": {"key": "config", "type": "{str}"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__( - self, *, config: Optional[Dict[str, str]] = None, enabled: Optional[bool] = None, **kwargs: Any - ) -> None: - """ - :keyword config: Config - Key-value pairs for configuring an add-on. - :paramtype config: dict[str, str] - :keyword enabled: Enabled - Whether the add-on is enabled or not. - :paramtype enabled: bool - """ - super().__init__(**kwargs) - self.config = config - self.enabled = enabled - - -class AddonStatus(_serialization.Model): - """Status of the addon. +class AddonStatusProfile(_serialization.Model): + """Defines the addon status profile. - :ivar error_message: ErrorMessage will be set in the event that there is a terminal problem - reconciling the AddOn and will contain a more verbose string suitable for logging and human - consumption. - :vartype error_message: str - :ivar phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :vartype phase: str - :ivar ready: + :ivar name: Name of the addon. + :vartype name: str + :ivar phase: Observed phase of the addon on the target cluster. Possible values include: + 'pending', 'provisioning', 'provisioning {HelmChartInstalled}', 'provisioning + {MSICertificateDownloaded}', 'provisioned', 'deleting', 'failed', 'upgrading'. Known values + are: "pending", "provisioning", "provisioning {HelmChartInstalled}", "provisioning + {MSICertificateDownloaded}", "provisioned", "deleting", "failed", and "upgrading". + :vartype phase: str or ~azure.mgmt.hybridcontainerservice.models.AddonPhase + :ivar ready: Indicates whether the addon is ready. :vartype ready: bool + :ivar error_message: Error message while deploying the addon. + :vartype error_message: str """ _attribute_map = { - "error_message": {"key": "errorMessage", "type": "str"}, + "name": {"key": "name", "type": "str"}, "phase": {"key": "phase", "type": "str"}, "ready": {"key": "ready", "type": "bool"}, + "error_message": {"key": "errorMessage", "type": "str"}, } def __init__( self, *, - error_message: Optional[str] = None, - phase: Optional[str] = None, + name: Optional[str] = None, + phase: Optional[Union[str, "_models.AddonPhase"]] = None, ready: Optional[bool] = None, + error_message: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword error_message: ErrorMessage will be set in the event that there is a terminal problem - reconciling the AddOn and will contain a more verbose string suitable for logging and human - consumption. - :paramtype error_message: str - :keyword phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :paramtype phase: str - :keyword ready: + :keyword name: Name of the addon. + :paramtype name: str + :keyword phase: Observed phase of the addon on the target cluster. Possible values include: + 'pending', 'provisioning', 'provisioning {HelmChartInstalled}', 'provisioning + {MSICertificateDownloaded}', 'provisioned', 'deleting', 'failed', 'upgrading'. Known values + are: "pending", "provisioning", "provisioning {HelmChartInstalled}", "provisioning + {MSICertificateDownloaded}", "provisioned", "deleting", "failed", and "upgrading". + :paramtype phase: str or ~azure.mgmt.hybridcontainerservice.models.AddonPhase + :keyword ready: Indicates whether the addon is ready. :paramtype ready: bool + :keyword error_message: Error message while deploying the addon. + :paramtype error_message: str """ super().__init__(**kwargs) - self.error_message = error_message + self.name = name self.phase = phase self.ready = ready + self.error_message = error_message class AgentPool(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -271,44 +94,31 @@ class AgentPool(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData - :ivar extended_location: - :vartype extended_location: ~azure.mgmt.hybridcontainerservice.models.AgentPoolExtendedLocation - :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the - range of 1 to 100 (inclusive). The default value is 1. - :vartype count: int + :ivar extended_location: Extended Location definition. + :vartype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :ivar node_image_version: The version of node image. :vartype node_image_version: str + :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. + :vartype count: int :ivar vm_size: VmSize - The size of the agent pool VMs. :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Deleting", "InProgress", - and "Canceled". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". :vartype provisioning_state: str or - ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningState - :ivar status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar status: Defines the observed state of the agent pool. :vartype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus """ @@ -327,19 +137,13 @@ class AgentPool(_serialization.Model): # pylint: disable=too-many-instance-attr "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "AgentPoolExtendedLocation"}, - "count": {"key": "properties.count", "type": "int"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, - "max_count": {"key": "properties.maxCount", "type": "int"}, - "max_pods": {"key": "properties.maxPods", "type": "int"}, - "min_count": {"key": "properties.minCount", "type": "int"}, - "mode": {"key": "properties.mode", "type": "str"}, - "node_labels": {"key": "properties.nodeLabels", "type": "{str}"}, - "node_taints": {"key": "properties.nodeTaints", "type": "[str]"}, "os_type": {"key": "properties.osType", "type": "str"}, + "os_sku": {"key": "properties.osSKU", "type": "str"}, "node_image_version": {"key": "properties.nodeImageVersion", "type": "str"}, + "count": {"key": "properties.count", "type": "int"}, "vm_size": {"key": "properties.vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "properties.cloudProviderProfile", "type": "CloudProviderProfile"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "status": {"key": "properties.status", "type": "AgentPoolProvisioningStatusStatus"}, } @@ -349,19 +153,13 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - extended_location: Optional["_models.AgentPoolExtendedLocation"] = None, - count: int = 1, + extended_location: Optional["_models.ExtendedLocation"] = None, availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", + os_type: Optional[Union[str, "_models.OsType"]] = None, + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, node_image_version: Optional[str] = None, + count: int = 1, vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, status: Optional["_models.AgentPoolProvisioningStatusStatus"] = None, **kwargs: Any ) -> None: @@ -370,42 +168,26 @@ def __init__( :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.hybridcontainerservice.models.AgentPoolExtendedLocation - :keyword count: Count - Number of agents to host docker containers. Allowed values must be in - the range of 1 to 100 (inclusive). The default value is 1. - :paramtype count: int + :keyword extended_location: Extended Location definition. + :paramtype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :keyword os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :keyword node_image_version: The version of node image. :paramtype node_image_version: str + :keyword count: Count - Number of agents to host docker containers. Allowed values must be in + the range of 1 to 100 (inclusive). The default value is 1. + :paramtype count: int :keyword vm_size: VmSize - The size of the agent pool VMs. :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :keyword status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + :keyword status: Defines the observed state of the agent pool. :paramtype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus """ super().__init__(**kwargs) @@ -416,50 +198,18 @@ def __init__( self.tags = tags self.system_data = None self.extended_location = extended_location - self.count = count self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints self.os_type = os_type + self.os_sku = os_sku self.node_image_version = node_image_version + self.count = count self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile self.provisioning_state = None self.status = status -class AgentPoolExtendedLocation(_serialization.Model): - """AgentPoolExtendedLocation. - - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - class AgentPoolListResult(_serialization.Model): - """AgentPoolListResult. + """A list of agent pool resources. :ivar value: :vartype value: list[~azure.mgmt.hybridcontainerservice.models.AgentPool] @@ -508,121 +258,78 @@ def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: self.name = name -class AgentPoolProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes - """NodePool configuration. +class AgentPoolPatch(_serialization.Model): + """The agentPool resource patch definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class AgentPoolProfile(_serialization.Model): + """AgentPool configuration. - :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the - range of 1 to 100 (inclusive). The default value is 1. - :vartype count: int :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar vm_size: VmSize - The size of the agent pool VMs. - :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ _attribute_map = { - "count": {"key": "count", "type": "int"}, "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "max_count": {"key": "maxCount", "type": "int"}, - "max_pods": {"key": "maxPods", "type": "int"}, - "min_count": {"key": "minCount", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "node_labels": {"key": "nodeLabels", "type": "{str}"}, - "node_taints": {"key": "nodeTaints", "type": "[str]"}, "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, "node_image_version": {"key": "nodeImageVersion", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, } def __init__( self, *, - count: int = 1, availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", + os_type: Optional[Union[str, "_models.OsType"]] = None, + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, node_image_version: Optional[str] = None, - vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, **kwargs: Any ) -> None: """ - :keyword count: Count - Number of agents to host docker containers. Allowed values must be in - the range of 1 to 100 (inclusive). The default value is 1. - :paramtype count: int :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :keyword os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :keyword node_image_version: The version of node image. :paramtype node_image_version: str - :keyword vm_size: VmSize - The size of the agent pool VMs. - :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ super().__init__(**kwargs) - self.count = count self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints self.os_type = os_type + self.os_sku = os_sku self.node_image_version = node_image_version - self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile class AgentPoolProvisioningStatus(_serialization.Model): @@ -630,11 +337,12 @@ class AgentPoolProvisioningStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Deleting", "InProgress", - and "Canceled". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". :vartype provisioning_state: str or - ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningState - :ivar status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar status: Defines the observed state of the agent pool. :vartype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus """ @@ -649,7 +357,7 @@ class AgentPoolProvisioningStatus(_serialization.Model): def __init__(self, *, status: Optional["_models.AgentPoolProvisioningStatusStatus"] = None, **kwargs: Any) -> None: """ - :keyword status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + :keyword status: Defines the observed state of the agent pool. :paramtype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus """ super().__init__(**kwargs) @@ -657,50 +365,63 @@ def __init__(self, *, status: Optional["_models.AgentPoolProvisioningStatusStatu self.status = status -class AgentPoolProperties( - AgentPoolProfile, AgentPoolProvisioningStatus -): # pylint: disable=too-many-instance-attributes +class AgentPoolUpdateProfile(_serialization.Model): + """AgentPool update configuration. + + :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the + range of 1 to 100 (inclusive). The default value is 1. + :vartype count: int + :ivar vm_size: VmSize - The size of the agent pool VMs. + :vartype vm_size: str + """ + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, + } + + def __init__(self, *, count: int = 1, vm_size: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword count: Count - Number of agents to host docker containers. Allowed values must be in + the range of 1 to 100 (inclusive). The default value is 1. + :paramtype count: int + :keyword vm_size: VmSize - The size of the agent pool VMs. + :paramtype vm_size: str + """ + super().__init__(**kwargs) + self.count = count + self.vm_size = vm_size + + +class AgentPoolProperties(AgentPoolProfile, AgentPoolUpdateProfile, AgentPoolProvisioningStatus): """AgentPoolProperties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Deleting", "InProgress", - and "Canceled". + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". :vartype provisioning_state: str or - ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningState - :ivar status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar status: Defines the observed state of the agent pool. :vartype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :vartype count: int + :ivar vm_size: VmSize - The size of the agent pool VMs. + :vartype vm_size: str :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar vm_size: VmSize - The size of the agent pool VMs. - :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ _validation = { @@ -711,17 +432,11 @@ class AgentPoolProperties( "provisioning_state": {"key": "provisioningState", "type": "str"}, "status": {"key": "status", "type": "AgentPoolProvisioningStatusStatus"}, "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "max_count": {"key": "maxCount", "type": "int"}, - "max_pods": {"key": "maxPods", "type": "int"}, - "min_count": {"key": "minCount", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "node_labels": {"key": "nodeLabels", "type": "{str}"}, - "node_taints": {"key": "nodeTaints", "type": "[str]"}, "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, "node_image_version": {"key": "nodeImageVersion", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, } def __init__( @@ -729,89 +444,97 @@ def __init__( *, status: Optional["_models.AgentPoolProvisioningStatusStatus"] = None, count: int = 1, + vm_size: Optional[str] = None, availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", + os_type: Optional[Union[str, "_models.OsType"]] = None, + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, node_image_version: Optional[str] = None, - vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, **kwargs: Any ) -> None: """ - :keyword status: HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + :keyword status: Defines the observed state of the agent pool. :paramtype status: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatus :keyword count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int + :keyword vm_size: VmSize - The size of the agent pool VMs. + :paramtype vm_size: str :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :keyword os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :keyword node_image_version: The version of node image. :paramtype node_image_version: str - :keyword vm_size: VmSize - The size of the agent pool VMs. - :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ super().__init__( - count=count, availability_zones=availability_zones, - max_count=max_count, - max_pods=max_pods, - min_count=min_count, - mode=mode, - node_labels=node_labels, - node_taints=node_taints, os_type=os_type, + os_sku=os_sku, node_image_version=node_image_version, + count=count, vm_size=vm_size, - cloud_provider_profile=cloud_provider_profile, status=status, **kwargs ) self.provisioning_state = None self.status = status self.count = count + self.vm_size = vm_size self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints self.os_type = os_type + self.os_sku = os_sku self.node_image_version = node_image_version - self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile -class AgentPoolProvisioningStatusError(_serialization.Model): - """AgentPoolProvisioningStatusError. +class AgentPoolProvisioningStatusOperationStatus(_serialization.Model): + """Contains Provisioning errors. + + :ivar error: + :vartype error: + ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusOperationStatusError + :ivar operation_id: + :vartype operation_id: str + :ivar status: + :vartype status: str + """ + + _attribute_map = { + "error": {"key": "error", "type": "AgentPoolProvisioningStatusOperationStatusError"}, + "operation_id": {"key": "operationId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + error: Optional["_models.AgentPoolProvisioningStatusOperationStatusError"] = None, + operation_id: Optional[str] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword error: + :paramtype error: + ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusOperationStatusError + :keyword operation_id: + :paramtype operation_id: str + :keyword status: + :paramtype status: str + """ + super().__init__(**kwargs) + self.error = error + self.operation_id = operation_id + self.status = status + + +class AgentPoolProvisioningStatusOperationStatusError(_serialization.Model): + """AgentPoolProvisioningStatusOperationStatusError. :ivar code: :vartype code: str @@ -837,251 +560,64 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, class AgentPoolProvisioningStatusStatus(_serialization.Model): - """HybridAKSNodePoolStatus defines the observed state of HybridAKSNodePool. + """Defines the observed state of the agent pool. - :ivar error_message: ErrorMessage - Error messages during creation of cluster. + :ivar error_message: ErrorMessage - Error messages during creation of agent pool. :vartype error_message: str - :ivar provisioning_status: Contains Provisioning errors. - :vartype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatusProvisioningStatus - :ivar ready_replicas: Total number of ready machines targeted by this deployment. - :vartype ready_replicas: int - :ivar replicas: Total number of non-terminated machines targeted by this deployment. - :vartype replicas: int + :ivar operation_status: Contains Provisioning errors. + :vartype operation_status: + ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusOperationStatus + :ivar ready_replicas: + :vartype ready_replicas: list[~azure.mgmt.hybridcontainerservice.models.AgentPoolUpdateProfile] """ _attribute_map = { "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": { - "key": "provisioningStatus", - "type": "AgentPoolProvisioningStatusStatusProvisioningStatus", - }, - "ready_replicas": {"key": "readyReplicas", "type": "int"}, - "replicas": {"key": "replicas", "type": "int"}, + "operation_status": {"key": "operationStatus", "type": "AgentPoolProvisioningStatusOperationStatus"}, + "ready_replicas": {"key": "readyReplicas", "type": "[AgentPoolUpdateProfile]"}, } def __init__( self, *, error_message: Optional[str] = None, - provisioning_status: Optional["_models.AgentPoolProvisioningStatusStatusProvisioningStatus"] = None, - ready_replicas: Optional[int] = None, - replicas: Optional[int] = None, + operation_status: Optional["_models.AgentPoolProvisioningStatusOperationStatus"] = None, + ready_replicas: Optional[List["_models.AgentPoolUpdateProfile"]] = None, **kwargs: Any ) -> None: """ - :keyword error_message: ErrorMessage - Error messages during creation of cluster. + :keyword error_message: ErrorMessage - Error messages during creation of agent pool. :paramtype error_message: str - :keyword provisioning_status: Contains Provisioning errors. - :paramtype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusStatusProvisioningStatus - :keyword ready_replicas: Total number of ready machines targeted by this deployment. - :paramtype ready_replicas: int - :keyword replicas: Total number of non-terminated machines targeted by this deployment. - :paramtype replicas: int + :keyword operation_status: Contains Provisioning errors. + :paramtype operation_status: + ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusOperationStatus + :keyword ready_replicas: + :paramtype ready_replicas: + list[~azure.mgmt.hybridcontainerservice.models.AgentPoolUpdateProfile] """ super().__init__(**kwargs) self.error_message = error_message - self.provisioning_status = provisioning_status + self.operation_status = operation_status self.ready_replicas = ready_replicas - self.replicas = replicas -class AgentPoolProvisioningStatusStatusProvisioningStatus(_serialization.Model): - """Contains Provisioning errors. - - :ivar error: - :vartype error: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusError - :ivar operation_id: - :vartype operation_id: str - :ivar phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :vartype phase: str - :ivar status: - :vartype status: str - """ - - _attribute_map = { - "error": {"key": "error", "type": "AgentPoolProvisioningStatusError"}, - "operation_id": {"key": "operationId", "type": "str"}, - "phase": {"key": "phase", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - error: Optional["_models.AgentPoolProvisioningStatusError"] = None, - operation_id: Optional[str] = None, - phase: Optional[str] = None, - status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: - :paramtype error: ~azure.mgmt.hybridcontainerservice.models.AgentPoolProvisioningStatusError - :keyword operation_id: - :paramtype operation_id: str - :keyword phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :paramtype phase: str - :keyword status: - :paramtype status: str - """ - super().__init__(**kwargs) - self.error = error - self.operation_id = operation_id - self.phase = phase - self.status = status - - -class ArcAgentProfile(_serialization.Model): - """Defines the Arc Agent properties for the Provisioned clusters. - - :ivar agent_version: Version of the Arc agents to be installed on the provisioned Provisioned - cluster resource. - :vartype agent_version: str - :ivar agent_auto_upgrade: Indicates whether the Arc agents on the provisioned clusters be - upgraded automatically to the latest version. Defaults to Enabled. Known values are: "Enabled" - and "Disabled". - :vartype agent_auto_upgrade: str or - ~azure.mgmt.hybridcontainerservice.models.AutoUpgradeOptions - """ - - _attribute_map = { - "agent_version": {"key": "agentVersion", "type": "str"}, - "agent_auto_upgrade": {"key": "agentAutoUpgrade", "type": "str"}, - } - - def __init__( - self, - *, - agent_version: Optional[str] = None, - agent_auto_upgrade: Union[str, "_models.AutoUpgradeOptions"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :keyword agent_version: Version of the Arc agents to be installed on the provisioned - Provisioned cluster resource. - :paramtype agent_version: str - :keyword agent_auto_upgrade: Indicates whether the Arc agents on the provisioned clusters be - upgraded automatically to the latest version. Defaults to Enabled. Known values are: "Enabled" - and "Disabled". - :paramtype agent_auto_upgrade: str or - ~azure.mgmt.hybridcontainerservice.models.AutoUpgradeOptions - """ - super().__init__(**kwargs) - self.agent_version = agent_version - self.agent_auto_upgrade = agent_auto_upgrade - - -class ArcAgentStatus(_serialization.Model): - """Defines the observed Arc Agent status that is resourceSynced back to the ARM resource. - - :ivar deployment_state: Observed deployment state of the Arc Agents on the target cluster. - Possible values include: 'pending', 'provisioning', 'provisioned', 'deleting', 'failed', - 'upgrading'. Known values are: "pending", "provisioning", "provisioned", "deleting", "failed", - and "upgrading". - :vartype deployment_state: str or ~azure.mgmt.hybridcontainerservice.models.DeploymentState - :ivar error_message: Error messages while onboarding/upgrading/uninstalling the Arc agents. - :vartype error_message: str - :ivar onboarding_public_key: Onboarding public key for provisioning the Managed identity for - the HybridAKS cluster. Will be used to create the hybridIdentityMetadata proxy resource and - will not be persisted. - :vartype onboarding_public_key: str - :ivar agent_version: Version of the Arc agents currently running on the Provisioned cluster - resource. - :vartype agent_version: str - :ivar core_count: Number of CPU cores present in the Provisioned cluster resource. - :vartype core_count: int - :ivar managed_identity_certificate_expiration_time: ManagedIdentity certificate expiration time - (ValidUntil). - :vartype managed_identity_certificate_expiration_time: ~datetime.datetime - :ivar last_connectivity_time: Last connected timestamp of the Provisioned cluster resource. - :vartype last_connectivity_time: ~datetime.datetime - """ - - _attribute_map = { - "deployment_state": {"key": "deploymentState", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "onboarding_public_key": {"key": "onboardingPublicKey", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "core_count": {"key": "coreCount", "type": "int"}, - "managed_identity_certificate_expiration_time": { - "key": "managedIdentityCertificateExpirationTime", - "type": "iso-8601", - }, - "last_connectivity_time": {"key": "lastConnectivityTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - deployment_state: Optional[Union[str, "_models.DeploymentState"]] = None, - error_message: Optional[str] = None, - onboarding_public_key: Optional[str] = None, - agent_version: Optional[str] = None, - core_count: Optional[int] = None, - managed_identity_certificate_expiration_time: Optional[datetime.datetime] = None, - last_connectivity_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword deployment_state: Observed deployment state of the Arc Agents on the target cluster. - Possible values include: 'pending', 'provisioning', 'provisioned', 'deleting', 'failed', - 'upgrading'. Known values are: "pending", "provisioning", "provisioned", "deleting", "failed", - and "upgrading". - :paramtype deployment_state: str or ~azure.mgmt.hybridcontainerservice.models.DeploymentState - :keyword error_message: Error messages while onboarding/upgrading/uninstalling the Arc agents. - :paramtype error_message: str - :keyword onboarding_public_key: Onboarding public key for provisioning the Managed identity for - the HybridAKS cluster. Will be used to create the hybridIdentityMetadata proxy resource and - will not be persisted. - :paramtype onboarding_public_key: str - :keyword agent_version: Version of the Arc agents currently running on the Provisioned cluster - resource. - :paramtype agent_version: str - :keyword core_count: Number of CPU cores present in the Provisioned cluster resource. - :paramtype core_count: int - :keyword managed_identity_certificate_expiration_time: ManagedIdentity certificate expiration - time (ValidUntil). - :paramtype managed_identity_certificate_expiration_time: ~datetime.datetime - :keyword last_connectivity_time: Last connected timestamp of the Provisioned cluster resource. - :paramtype last_connectivity_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.deployment_state = deployment_state - self.error_message = error_message - self.onboarding_public_key = onboarding_public_key - self.agent_version = agent_version - self.core_count = core_count - self.managed_identity_certificate_expiration_time = managed_identity_certificate_expiration_time - self.last_connectivity_time = last_connectivity_time - - -class CloudProviderProfile(_serialization.Model): - """CloudProviderProfile - The underlying cloud infra provider properties. +class CloudProviderProfile(_serialization.Model): + """CloudProviderProfile - The underlying cloud infra provider properties. :ivar infra_network_profile: InfraNetworkProfile - List of infra network profiles for the provisioned cluster. :vartype infra_network_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfileInfraNetworkProfile - :ivar infra_storage_profile: InfraStorageProfile - List of infra storage profiles for the - provisioned cluster. - :vartype infra_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfileInfraStorageProfile """ _attribute_map = { "infra_network_profile": {"key": "infraNetworkProfile", "type": "CloudProviderProfileInfraNetworkProfile"}, - "infra_storage_profile": {"key": "infraStorageProfile", "type": "CloudProviderProfileInfraStorageProfile"}, } def __init__( self, *, infra_network_profile: Optional["_models.CloudProviderProfileInfraNetworkProfile"] = None, - infra_storage_profile: Optional["_models.CloudProviderProfileInfraStorageProfile"] = None, **kwargs: Any ) -> None: """ @@ -1089,22 +625,17 @@ def __init__( provisioned cluster. :paramtype infra_network_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfileInfraNetworkProfile - :keyword infra_storage_profile: InfraStorageProfile - List of infra storage profiles for the - provisioned cluster. - :paramtype infra_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfileInfraStorageProfile """ super().__init__(**kwargs) self.infra_network_profile = infra_network_profile - self.infra_storage_profile = infra_storage_profile class CloudProviderProfileInfraNetworkProfile(_serialization.Model): """InfraNetworkProfile - List of infra network profiles for the provisioned cluster. - :ivar vnet_subnet_ids: Array of references to azure resource corresponding to the new - HybridAKSNetwork object e.g. - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}. + :ivar vnet_subnet_ids: Array of references to azure resource corresponding to the Network + object e.g. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}. :vartype vnet_subnet_ids: list[str] """ @@ -1114,39 +645,15 @@ class CloudProviderProfileInfraNetworkProfile(_serialization.Model): def __init__(self, *, vnet_subnet_ids: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword vnet_subnet_ids: Array of references to azure resource corresponding to the new - HybridAKSNetwork object e.g. - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}. + :keyword vnet_subnet_ids: Array of references to azure resource corresponding to the Network + object e.g. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}. :paramtype vnet_subnet_ids: list[str] """ super().__init__(**kwargs) self.vnet_subnet_ids = vnet_subnet_ids -class CloudProviderProfileInfraStorageProfile(_serialization.Model): - """InfraStorageProfile - List of infra storage profiles for the provisioned cluster. - - :ivar storage_space_ids: Reference to azure resource corresponding to the new HybridAKSStorage - object e.g. - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpaceName}. - :vartype storage_space_ids: list[str] - """ - - _attribute_map = { - "storage_space_ids": {"key": "storageSpaceIds", "type": "[str]"}, - } - - def __init__(self, *, storage_space_ids: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword storage_space_ids: Reference to azure resource corresponding to the new - HybridAKSStorage object e.g. - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpaceName}. - :paramtype storage_space_ids: list[str] - """ - super().__init__(**kwargs) - self.storage_space_ids = storage_space_ids - - class ControlPlaneEndpointProfile(_serialization.Model): """controlPlaneEndpoint - API server endpoint for the control plane. @@ -1183,20 +690,20 @@ class ControlPlaneEndpointProfileControlPlaneEndpoint(_serialization.Model): :ivar host_ip: Host IP address for API server. :vartype host_ip: str :ivar port: Port for the API server. - :vartype port: str + :vartype port: int """ _attribute_map = { "host_ip": {"key": "hostIP", "type": "str"}, - "port": {"key": "port", "type": "str"}, + "port": {"key": "port", "type": "int"}, } - def __init__(self, *, host_ip: Optional[str] = None, port: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, host_ip: Optional[str] = None, port: Optional[int] = None, **kwargs: Any) -> None: """ :keyword host_ip: Host IP address for API server. :paramtype host_ip: str :keyword port: Port for the API server. - :paramtype port: str + :paramtype port: int """ super().__init__(**kwargs) self.host_ip = host_ip @@ -1223,7 +730,7 @@ def __init__(self, *, linux_profile: Optional["_models.LinuxProfileProperties"] self.linux_profile = linux_profile -class NamedAgentPoolProfile(AgentPoolProfile, AgentPoolName): # pylint: disable=too-many-instance-attributes +class NamedAgentPoolProfile(AgentPoolProfile, AgentPoolUpdateProfile, AgentPoolName): """Agent pool profile along with a name parameter. :ivar name: Unique name of the agent pool profile in the context of the subscription and @@ -1232,50 +739,30 @@ class NamedAgentPoolProfile(AgentPoolProfile, AgentPoolName): # pylint: disable :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :vartype count: int + :ivar vm_size: VmSize - The size of the agent pool VMs. + :vartype vm_size: str :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar vm_size: VmSize - The size of the agent pool VMs. - :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ _attribute_map = { "name": {"key": "name", "type": "str"}, "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "max_count": {"key": "maxCount", "type": "int"}, - "max_pods": {"key": "maxPods", "type": "int"}, - "min_count": {"key": "minCount", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "node_labels": {"key": "nodeLabels", "type": "{str}"}, - "node_taints": {"key": "nodeTaints", "type": "[str]"}, "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, "node_image_version": {"key": "nodeImageVersion", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, } def __init__( @@ -1283,17 +770,11 @@ def __init__( *, name: Optional[str] = None, count: int = 1, + vm_size: Optional[str] = None, availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", + os_type: Optional[Union[str, "_models.OsType"]] = None, + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, node_image_version: Optional[str] = None, - vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, **kwargs: Any ) -> None: """ @@ -1303,70 +784,41 @@ def __init__( :keyword count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int + :keyword vm_size: VmSize - The size of the agent pool VMs. + :paramtype vm_size: str :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :keyword os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :keyword node_image_version: The version of node image. :paramtype node_image_version: str - :keyword vm_size: VmSize - The size of the agent pool VMs. - :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ super().__init__( - count=count, availability_zones=availability_zones, - max_count=max_count, - max_pods=max_pods, - min_count=min_count, - mode=mode, - node_labels=node_labels, - node_taints=node_taints, os_type=os_type, + os_sku=os_sku, node_image_version=node_image_version, + count=count, vm_size=vm_size, - cloud_provider_profile=cloud_provider_profile, name=name, **kwargs ) self.name = name self.count = count + self.vm_size = vm_size self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints self.os_type = os_type + self.os_sku = os_sku self.node_image_version = node_image_version - self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile -class ControlPlaneProfile( - NamedAgentPoolProfile, ControlPlaneEndpointProfile, LinuxProfile -): # pylint: disable=too-many-instance-attributes +class ControlPlaneProfile(NamedAgentPoolProfile, ControlPlaneEndpointProfile, LinuxProfile): """ControlPlaneProfile - The control plane properties for the provisioned cluster. :ivar linux_profile: Profile for Linux VMs in the container service cluster. @@ -1380,34 +832,20 @@ class ControlPlaneProfile( :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :vartype count: int + :ivar vm_size: VmSize - The size of the agent pool VMs. + :vartype vm_size: str :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar vm_size: VmSize - The size of the agent pool VMs. - :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ _attribute_map = { @@ -1418,17 +856,11 @@ class ControlPlaneProfile( }, "name": {"key": "name", "type": "str"}, "count": {"key": "count", "type": "int"}, + "vm_size": {"key": "vmSize", "type": "str"}, "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "max_count": {"key": "maxCount", "type": "int"}, - "max_pods": {"key": "maxPods", "type": "int"}, - "min_count": {"key": "minCount", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "node_labels": {"key": "nodeLabels", "type": "{str}"}, - "node_taints": {"key": "nodeTaints", "type": "[str]"}, "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSKU", "type": "str"}, "node_image_version": {"key": "nodeImageVersion", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, } def __init__( @@ -1438,17 +870,11 @@ def __init__( control_plane_endpoint: Optional["_models.ControlPlaneEndpointProfileControlPlaneEndpoint"] = None, name: Optional[str] = None, count: int = 1, + vm_size: Optional[str] = None, availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", + os_type: Optional[Union[str, "_models.OsType"]] = None, + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, node_image_version: Optional[str] = None, - vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, **kwargs: Any ) -> None: """ @@ -1463,50 +889,29 @@ def __init__( :keyword count: Count - Number of agents to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. :paramtype count: int + :keyword vm_size: VmSize - The size of the agent pool VMs. + :paramtype vm_size: str :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. Datacenter racks modelled as zones. :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". + :keyword os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU :keyword node_image_version: The version of node image. :paramtype node_image_version: str - :keyword vm_size: VmSize - The size of the agent pool VMs. - :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile """ super().__init__( name=name, count=count, + vm_size=vm_size, availability_zones=availability_zones, - max_count=max_count, - max_pods=max_pods, - min_count=min_count, - mode=mode, - node_labels=node_labels, - node_taints=node_taints, os_type=os_type, + os_sku=os_sku, node_image_version=node_image_version, - vm_size=vm_size, - cloud_provider_profile=cloud_provider_profile, control_plane_endpoint=control_plane_endpoint, linux_profile=linux_profile, **kwargs @@ -1515,17 +920,39 @@ def __init__( self.control_plane_endpoint = control_plane_endpoint self.name = name self.count = count + self.vm_size = vm_size self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints self.os_type = os_type + self.os_sku = os_sku self.node_image_version = node_image_version - self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile + + +class CredentialResult(_serialization.Model): + """The credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the credential. + :vartype name: str + :ivar value: Base64-encoded Kubernetes configuration file. + :vartype value: bytes + """ + + _validation = { + "name": {"readonly": True}, + "value": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "bytearray"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None class ErrorAdditionalInfo(_serialization.Model): @@ -1620,145 +1047,36 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class HttpProxyConfigPassword(_serialization.Model): - """HttpProxyConfigPassword. +class ExtendedLocation(_serialization.Model): + """Extended Location definition. - :ivar password: Password to use for connecting to proxy server. - :vartype password: str - """ - - _attribute_map = { - "password": {"key": "password", "type": "str"}, - } - - def __init__(self, *, password: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword password: Password to use for connecting to proxy server. - :paramtype password: str - """ - super().__init__(**kwargs) - self.password = password - - -class HttpProxyConfigResponse(_serialization.Model): - """Configurations for provisioning the cluster with HTTP proxy servers. - - :ivar http_proxy: The HTTP proxy server endpoint to use. - :vartype http_proxy: str - :ivar https_proxy: The HTTPS proxy server endpoint to use. - :vartype https_proxy: str - :ivar no_proxy: The endpoints that should not go through proxy. - :vartype no_proxy: list[str] - :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. - :vartype trusted_ca: str - :ivar username: Username to use for connecting to proxy server. - :vartype username: str + :ivar type: The extended location type. "CustomLocation" + :vartype type: str or ~azure.mgmt.hybridcontainerservice.models.ExtendedLocationTypes + :ivar name: The extended location name. + :vartype name: str """ _attribute_map = { - "http_proxy": {"key": "httpProxy", "type": "str"}, - "https_proxy": {"key": "httpsProxy", "type": "str"}, - "no_proxy": {"key": "noProxy", "type": "[str]"}, - "trusted_ca": {"key": "trustedCa", "type": "str"}, - "username": {"key": "username", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, } def __init__( self, *, - http_proxy: Optional[str] = None, - https_proxy: Optional[str] = None, - no_proxy: Optional[List[str]] = None, - trusted_ca: Optional[str] = None, - username: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword http_proxy: The HTTP proxy server endpoint to use. - :paramtype http_proxy: str - :keyword https_proxy: The HTTPS proxy server endpoint to use. - :paramtype https_proxy: str - :keyword no_proxy: The endpoints that should not go through proxy. - :paramtype no_proxy: list[str] - :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. - :paramtype trusted_ca: str - :keyword username: Username to use for connecting to proxy server. - :paramtype username: str + :keyword type: The extended location type. "CustomLocation" + :paramtype type: str or ~azure.mgmt.hybridcontainerservice.models.ExtendedLocationTypes + :keyword name: The extended location name. + :paramtype name: str """ super().__init__(**kwargs) - self.http_proxy = http_proxy - self.https_proxy = https_proxy - self.no_proxy = no_proxy - self.trusted_ca = trusted_ca - self.username = username - - -class HttpProxyConfig(HttpProxyConfigResponse, HttpProxyConfigPassword): - """Configurations for provisioning the cluster with HTTP proxy servers. - - :ivar password: Password to use for connecting to proxy server. - :vartype password: str - :ivar http_proxy: The HTTP proxy server endpoint to use. - :vartype http_proxy: str - :ivar https_proxy: The HTTPS proxy server endpoint to use. - :vartype https_proxy: str - :ivar no_proxy: The endpoints that should not go through proxy. - :vartype no_proxy: list[str] - :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. - :vartype trusted_ca: str - :ivar username: Username to use for connecting to proxy server. - :vartype username: str - """ - - _attribute_map = { - "password": {"key": "password", "type": "str"}, - "http_proxy": {"key": "httpProxy", "type": "str"}, - "https_proxy": {"key": "httpsProxy", "type": "str"}, - "no_proxy": {"key": "noProxy", "type": "[str]"}, - "trusted_ca": {"key": "trustedCa", "type": "str"}, - "username": {"key": "username", "type": "str"}, - } - - def __init__( - self, - *, - password: Optional[str] = None, - http_proxy: Optional[str] = None, - https_proxy: Optional[str] = None, - no_proxy: Optional[List[str]] = None, - trusted_ca: Optional[str] = None, - username: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword password: Password to use for connecting to proxy server. - :paramtype password: str - :keyword http_proxy: The HTTP proxy server endpoint to use. - :paramtype http_proxy: str - :keyword https_proxy: The HTTPS proxy server endpoint to use. - :paramtype https_proxy: str - :keyword no_proxy: The endpoints that should not go through proxy. - :paramtype no_proxy: list[str] - :keyword trusted_ca: Alternative CA cert to use for connecting to proxy servers. - :paramtype trusted_ca: str - :keyword username: Username to use for connecting to proxy server. - :paramtype username: str - """ - super().__init__( - http_proxy=http_proxy, - https_proxy=https_proxy, - no_proxy=no_proxy, - trusted_ca=trusted_ca, - username=username, - password=password, - **kwargs - ) - self.password = password - self.http_proxy = http_proxy - self.https_proxy = https_proxy - self.no_proxy = no_proxy - self.trusted_ca = trusted_ca - self.username = username + self.type = type + self.name = name class Resource(_serialization.Model): @@ -1766,26 +1084,31 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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"}, } def __init__(self, **kwargs: Any) -> None: @@ -1794,6 +1117,7 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): @@ -1802,26 +1126,31 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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"}, } def __init__(self, **kwargs: Any) -> None: @@ -1834,25 +1163,27 @@ class HybridIdentityMetadata(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData :ivar resource_uid: Unique id of the parent provisioned cluster resource. :vartype resource_uid: str :ivar public_key: Onboarding public key for provisioning the Managed identity for the HybridAKS cluster. :vartype public_key: str - :ivar identity: The identity of the provisioned cluster. - :vartype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity - :ivar provisioning_state: provisioning state of the hybridIdentityMetadata resource. - :vartype provisioning_state: str + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". + :vartype provisioning_state: str or + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState """ _validation = { @@ -1870,32 +1201,20 @@ class HybridIdentityMetadata(ProxyResource): "system_data": {"key": "systemData", "type": "SystemData"}, "resource_uid": {"key": "properties.resourceUid", "type": "str"}, "public_key": {"key": "properties.publicKey", "type": "str"}, - "identity": {"key": "properties.identity", "type": "ProvisionedClusterIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( - self, - *, - resource_uid: Optional[str] = None, - public_key: Optional[str] = None, - identity: Optional["_models.ProvisionedClusterIdentity"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_uid: Unique id of the parent provisioned cluster resource. :paramtype resource_uid: str :keyword public_key: Onboarding public key for provisioning the Managed identity for the HybridAKS cluster. :paramtype public_key: str - :keyword identity: The identity of the provisioned cluster. - :paramtype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity """ super().__init__(**kwargs) - self.system_data = None self.resource_uid = resource_uid self.public_key = public_key - self.identity = identity self.provisioning_state = None @@ -1933,1164 +1252,391 @@ def __init__( self.value = value -class LinuxProfileProperties(_serialization.Model): - """LinuxProfile - Profile for Linux VMs in the container service cluster. +class KubernetesPatchVersions(_serialization.Model): + """Kubernetes Patch Version profile. - :ivar admin_username: AdminUsername - The administrator username to use for Linux VMs. - :vartype admin_username: str - :ivar ssh: SSH - SSH configuration for Linux-based VMs running on Azure. - :vartype ssh: ~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSsh + :ivar readiness: Whether the kubernetes version variant (Linux, Windows, Windows2022) is ready + or not. + :vartype readiness: list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionReadiness] + :ivar upgrades: Possible upgrade path for given patch version. + :vartype upgrades: list[str] """ _attribute_map = { - "admin_username": {"key": "adminUsername", "type": "str"}, - "ssh": {"key": "ssh", "type": "LinuxProfilePropertiesSsh"}, + "readiness": {"key": "readiness", "type": "[KubernetesVersionReadiness]"}, + "upgrades": {"key": "upgrades", "type": "[str]"}, } def __init__( self, *, - admin_username: Optional[str] = None, - ssh: Optional["_models.LinuxProfilePropertiesSsh"] = None, + readiness: Optional[List["_models.KubernetesVersionReadiness"]] = None, + upgrades: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword admin_username: AdminUsername - The administrator username to use for Linux VMs. - :paramtype admin_username: str - :keyword ssh: SSH - SSH configuration for Linux-based VMs running on Azure. - :paramtype ssh: ~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSsh + :keyword readiness: Whether the kubernetes version variant (Linux, Windows, Windows2022) is + ready or not. + :paramtype readiness: + list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionReadiness] + :keyword upgrades: Possible upgrade path for given patch version. + :paramtype upgrades: list[str] """ super().__init__(**kwargs) - self.admin_username = admin_username - self.ssh = ssh + self.readiness = readiness + self.upgrades = upgrades -class LinuxProfilePropertiesSsh(_serialization.Model): - """SSH - SSH configuration for Linux-based VMs running on Azure. +class KubernetesVersionCapabilities(_serialization.Model): + """Capabilities on this kubernetes version. - :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. - :vartype public_keys: - list[~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSshPublicKeysItem] + :ivar support_plan: + :vartype support_plan: list[str] """ _attribute_map = { - "public_keys": {"key": "publicKeys", "type": "[LinuxProfilePropertiesSshPublicKeysItem]"}, + "support_plan": {"key": "supportPlan", "type": "[str]"}, } - def __init__( - self, *, public_keys: Optional[List["_models.LinuxProfilePropertiesSshPublicKeysItem"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, support_plan: Optional[List[Literal["KubernetesOfficial"]]] = None, **kwargs: Any) -> None: """ - :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with - Linux-based VMs. Only expect one key specified. - :paramtype public_keys: - list[~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSshPublicKeysItem] + :keyword support_plan: + :paramtype support_plan: list[str] """ super().__init__(**kwargs) - self.public_keys = public_keys + self.support_plan = support_plan -class LinuxProfilePropertiesSshPublicKeysItem(_serialization.Model): - """LinuxProfilePropertiesSshPublicKeysItem. +class KubernetesVersionProfile(ProxyResource): + """The supported kubernetes versions. - :ivar key_data: KeyData - Certificate public key used to authenticate with VMs through SSH. The - certificate must be in PEM format with or without headers. - :vartype key_data: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :ivar extended_location: Extended Location definition. + :vartype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation + :ivar properties: + :vartype properties: + ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfileProperties """ - _attribute_map = { - "key_data": {"key": "keyData", "type": "str"}, + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, } - def __init__(self, *, key_data: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword key_data: KeyData - Certificate public key used to authenticate with VMs through SSH. - The certificate must be in PEM format with or without headers. - :paramtype key_data: str + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "properties": {"key": "properties", "type": "KubernetesVersionProfileProperties"}, + } + + def __init__(self, *, extended_location: Optional["_models.ExtendedLocation"] = None, **kwargs: Any) -> None: + """ + :keyword extended_location: Extended Location definition. + :paramtype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation """ super().__init__(**kwargs) - self.key_data = key_data + self.extended_location = extended_location + self.properties = None -class LoadBalancerProfile(NamedAgentPoolProfile, LinuxProfile): # pylint: disable=too-many-instance-attributes - """LoadBalancerProfile - Profile of the cluster load balancer. +class KubernetesVersionProfileList(_serialization.Model): + """A list of kubernetes version resources. - :ivar linux_profile: Profile for Linux VMs in the container service cluster. - :vartype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :ivar name: Unique name of the agent pool profile in the context of the subscription and - resource group. - :vartype name: str - :ivar count: Count - Number of agents to host docker containers. Allowed values must be in the - range of 1 to 100 (inclusive). The default value is 1. - :vartype count: int - :ivar availability_zones: AvailabilityZones - The list of Availability zones to use for nodes. - Datacenter racks modelled as zones. - :vartype availability_zones: list[str] - :ivar max_count: The maximum number of nodes for auto-scaling. - :vartype max_count: int - :ivar max_pods: The maximum number of pods that can run on a node. - :vartype max_pods: int - :ivar min_count: The minimum number of nodes for auto-scaling. - :vartype min_count: int - :ivar mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :vartype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :ivar node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :vartype node_labels: dict[str, str] - :ivar node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :vartype node_taints: list[str] - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". - :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType - :ivar node_image_version: The version of node image. - :vartype node_image_version: str - :ivar vm_size: VmSize - The size of the agent pool VMs. - :vartype vm_size: str - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile + :ivar value: + :vartype value: list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :ivar next_link: + :vartype next_link: str """ _attribute_map = { - "linux_profile": {"key": "linuxProfile", "type": "LinuxProfileProperties"}, - "name": {"key": "name", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "availability_zones": {"key": "availabilityZones", "type": "[str]"}, - "max_count": {"key": "maxCount", "type": "int"}, - "max_pods": {"key": "maxPods", "type": "int"}, - "min_count": {"key": "minCount", "type": "int"}, - "mode": {"key": "mode", "type": "str"}, - "node_labels": {"key": "nodeLabels", "type": "{str}"}, - "node_taints": {"key": "nodeTaints", "type": "[str]"}, - "os_type": {"key": "osType", "type": "str"}, - "node_image_version": {"key": "nodeImageVersion", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, + "value": {"key": "value", "type": "[KubernetesVersionProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - linux_profile: Optional["_models.LinuxProfileProperties"] = None, - name: Optional[str] = None, - count: int = 1, - availability_zones: Optional[List[str]] = None, - max_count: Optional[int] = None, - max_pods: Optional[int] = None, - min_count: Optional[int] = None, - mode: Union[str, "_models.Mode"] = "User", - node_labels: Optional[Dict[str, str]] = None, - node_taints: Optional[List[str]] = None, - os_type: Union[str, "_models.OsType"] = "Linux", - node_image_version: Optional[str] = None, - vm_size: Optional[str] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, + value: Optional[List["_models.KubernetesVersionProfile"]] = None, + next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword linux_profile: Profile for Linux VMs in the container service cluster. - :paramtype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :keyword name: Unique name of the agent pool profile in the context of the subscription and - resource group. - :paramtype name: str - :keyword count: Count - Number of agents to host docker containers. Allowed values must be in - the range of 1 to 100 (inclusive). The default value is 1. - :paramtype count: int - :keyword availability_zones: AvailabilityZones - The list of Availability zones to use for - nodes. Datacenter racks modelled as zones. - :paramtype availability_zones: list[str] - :keyword max_count: The maximum number of nodes for auto-scaling. - :paramtype max_count: int - :keyword max_pods: The maximum number of pods that can run on a node. - :paramtype max_pods: int - :keyword min_count: The minimum number of nodes for auto-scaling. - :paramtype min_count: int - :keyword mode: Mode - AgentPoolMode represents mode of an agent pool. Possible values include: - 'System', 'LB', 'User'. Default is 'User'. Known values are: "System", "LB", and "User". - :paramtype mode: str or ~azure.mgmt.hybridcontainerservice.models.Mode - :keyword node_labels: NodeLabels - Agent pool node labels to be persisted across all nodes in - agent pool. - :paramtype node_labels: dict[str, str] - :keyword node_taints: NodeTaints - Taints added to new nodes during node pool create and scale. - For example, key=value:NoSchedule. - :paramtype node_taints: list[str] - :keyword os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". - :paramtype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType - :keyword node_image_version: The version of node image. - :paramtype node_image_version: str - :keyword vm_size: VmSize - The size of the agent pool VMs. - :paramtype vm_size: str - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile + :keyword value: + :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :keyword next_link: + :paramtype next_link: str """ - super().__init__( - name=name, - count=count, - availability_zones=availability_zones, - max_count=max_count, - max_pods=max_pods, - min_count=min_count, - mode=mode, - node_labels=node_labels, - node_taints=node_taints, - os_type=os_type, - node_image_version=node_image_version, - vm_size=vm_size, - cloud_provider_profile=cloud_provider_profile, - linux_profile=linux_profile, - **kwargs - ) - self.linux_profile = linux_profile - self.name = name - self.count = count - self.availability_zones = availability_zones - self.max_count = max_count - self.max_pods = max_pods - self.min_count = min_count - self.mode = mode - self.node_labels = node_labels - self.node_taints = node_taints - self.os_type = os_type - self.node_image_version = node_image_version - self.vm_size = vm_size - self.cloud_provider_profile = cloud_provider_profile + super().__init__(**kwargs) + self.value = value + self.next_link = next_link -class NetworkProfile(_serialization.Model): - """NetworkProfile - Profile of network configuration. +class KubernetesVersionProfileProperties(_serialization.Model): + """KubernetesVersionProfileProperties. - :ivar load_balancer_profile: LoadBalancerProfile - Profile of the cluster load balancer. - :vartype load_balancer_profile: ~azure.mgmt.hybridcontainerservice.models.LoadBalancerProfile - :ivar load_balancer_sku: LoadBalancerSku - The load balancer sku for the provisioned cluster. - Possible values: 'unstacked-haproxy', 'stacked-kube-vip', 'stacked-metallb', 'unmanaged'. The - default is 'unmanaged'. Known values are: "unstacked-haproxy", "stacked-kube-vip", - "stacked-metallb", and "unmanaged". - :vartype load_balancer_sku: str or ~azure.mgmt.hybridcontainerservice.models.LoadBalancerSku - :ivar dns_service_ip: DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It - must be within the Kubernetes service address range specified in serviceCidr. - :vartype dns_service_ip: str - :ivar network_policy: NetworkPolicy - Network policy used for building Kubernetes network. - Possible values include: 'calico', 'flannel'. Default is 'calico'. Known values are: "calico" - and "flannel". - :vartype network_policy: str or ~azure.mgmt.hybridcontainerservice.models.NetworkPolicy - :ivar pod_cidr: PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is - used. - :vartype pod_cidr: str - :ivar pod_cidrs: The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is - expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :vartype pod_cidrs: list[str] - :ivar service_cidr: ServiceCidr - A CIDR notation IP range from which to assign service cluster - IPs. It must not overlap with any Subnet IP ranges. - :vartype service_cidr: str - :ivar service_cidrs: The CIDR notation IP ranges from which to assign service cluster IPs. One - IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family - (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP - ranges. - :vartype service_cidrs: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". + :vartype provisioning_state: str or + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar values: List of supported Kubernetes versions. + :vartype values: list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProperties] """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "load_balancer_profile": {"key": "loadBalancerProfile", "type": "LoadBalancerProfile"}, - "load_balancer_sku": {"key": "loadBalancerSku", "type": "str"}, - "dns_service_ip": {"key": "dnsServiceIP", "type": "str"}, - "network_policy": {"key": "networkPolicy", "type": "str"}, - "pod_cidr": {"key": "podCidr", "type": "str"}, - "pod_cidrs": {"key": "podCidrs", "type": "[str]"}, - "service_cidr": {"key": "serviceCidr", "type": "str"}, - "service_cidrs": {"key": "serviceCidrs", "type": "[str]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "values": {"key": "values", "type": "[KubernetesVersionProperties]"}, } - def __init__( - self, - *, - load_balancer_profile: Optional["_models.LoadBalancerProfile"] = None, - load_balancer_sku: Union[str, "_models.LoadBalancerSku"] = "unmanaged", - dns_service_ip: Optional[str] = None, - network_policy: Union[str, "_models.NetworkPolicy"] = "calico", - pod_cidr: Optional[str] = None, - pod_cidrs: Optional[List[str]] = None, - service_cidr: Optional[str] = None, - service_cidrs: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, values: Optional[List["_models.KubernetesVersionProperties"]] = None, **kwargs: Any) -> None: """ - :keyword load_balancer_profile: LoadBalancerProfile - Profile of the cluster load balancer. - :paramtype load_balancer_profile: ~azure.mgmt.hybridcontainerservice.models.LoadBalancerProfile - :keyword load_balancer_sku: LoadBalancerSku - The load balancer sku for the provisioned - cluster. Possible values: 'unstacked-haproxy', 'stacked-kube-vip', 'stacked-metallb', - 'unmanaged'. The default is 'unmanaged'. Known values are: "unstacked-haproxy", - "stacked-kube-vip", "stacked-metallb", and "unmanaged". - :paramtype load_balancer_sku: str or ~azure.mgmt.hybridcontainerservice.models.LoadBalancerSku - :keyword dns_service_ip: DNSServiceIP - An IP address assigned to the Kubernetes DNS service. - It must be within the Kubernetes service address range specified in serviceCidr. - :paramtype dns_service_ip: str - :keyword network_policy: NetworkPolicy - Network policy used for building Kubernetes network. - Possible values include: 'calico', 'flannel'. Default is 'calico'. Known values are: "calico" - and "flannel". - :paramtype network_policy: str or ~azure.mgmt.hybridcontainerservice.models.NetworkPolicy - :keyword pod_cidr: PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet - is used. - :paramtype pod_cidr: str - :keyword pod_cidrs: The CIDR notation IP ranges from which to assign pod IPs. One IPv4 CIDR is - expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is - expected for dual-stack networking. - :paramtype pod_cidrs: list[str] - :keyword service_cidr: ServiceCidr - A CIDR notation IP range from which to assign service - cluster IPs. It must not overlap with any Subnet IP ranges. - :paramtype service_cidr: str - :keyword service_cidrs: The CIDR notation IP ranges from which to assign service cluster IPs. - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family - (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP - ranges. - :paramtype service_cidrs: list[str] + :keyword values: List of supported Kubernetes versions. + :paramtype values: list[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProperties] """ super().__init__(**kwargs) - self.load_balancer_profile = load_balancer_profile - self.load_balancer_sku = load_balancer_sku - self.dns_service_ip = dns_service_ip - self.network_policy = network_policy - self.pod_cidr = pod_cidr - self.pod_cidrs = pod_cidrs - self.service_cidr = service_cidr - self.service_cidrs = service_cidrs + self.provisioning_state = None + self.values = values -class OrchestratorProfile(_serialization.Model): - """Contains information about orchestrator. +class KubernetesVersionProperties(_serialization.Model): + """Kubernetes version profile for given major.minor release. Variables are only populated by the server, and will be ignored when sending a request. - :ivar is_preview: Whether Kubernetes version is currently in preview. + :ivar version: major.minor version of Kubernetes release. + :vartype version: str + :ivar capabilities: Capabilities on this kubernetes version. + :vartype capabilities: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionCapabilities + :ivar is_preview: Whether this version is in preview mode. :vartype is_preview: bool - :ivar orchestrator_type: Orchestrator type. - :vartype orchestrator_type: str - :ivar orchestrator_version: Orchestrator version (major, minor, patch). - :vartype orchestrator_version: str + :ivar patch_versions: Patch versions of a Kubernetes release. + :vartype patch_versions: dict[str, + ~azure.mgmt.hybridcontainerservice.models.KubernetesPatchVersions] """ _validation = { + "version": {"readonly": True}, + "capabilities": {"readonly": True}, "is_preview": {"readonly": True}, - "orchestrator_type": {"readonly": True}, - "orchestrator_version": {"readonly": True}, + "patch_versions": {"readonly": True}, } _attribute_map = { + "version": {"key": "version", "type": "str"}, + "capabilities": {"key": "capabilities", "type": "KubernetesVersionCapabilities"}, "is_preview": {"key": "isPreview", "type": "bool"}, - "orchestrator_type": {"key": "orchestratorType", "type": "str"}, - "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, + "patch_versions": {"key": "patchVersions", "type": "{KubernetesPatchVersions}"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.version = None + self.capabilities = None self.is_preview = None - self.orchestrator_type = None - self.orchestrator_version = None + self.patch_versions = None -class OrchestratorVersionProfile(_serialization.Model): - """The profile of an orchestrator and its available versions. +class KubernetesVersionReadiness(_serialization.Model): + """Whether a particular kubernetes version's variant (CBLMariner, Windows, Windows2022) is ready + or not. Variables are only populated by the server, and will be ignored when sending a request. - :ivar is_preview: Whether Kubernetes version is currently in preview. - :vartype is_preview: bool - :ivar default: Installed by default if version is not specified. - :vartype default: bool - :ivar orchestrator_type: Orchestrator type. - :vartype orchestrator_type: str - :ivar orchestrator_version: Orchestrator version major.minor.patch, for example 1.21.9. - :vartype orchestrator_version: str - :ivar upgrades: The list of available upgrade versions. - :vartype upgrades: list[~azure.mgmt.hybridcontainerservice.models.OrchestratorProfile] + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if OSType + is Linux. The default is Windows2019 when OSType is Windows. Known values are: "CBLMariner", + "Windows2019", and "Windows2022". + :vartype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU + :ivar ready: Whether or not the given image is ready. + :vartype ready: bool + :ivar error_message: If image is not ready, the error message for version not being ready. + :vartype error_message: str """ _validation = { - "is_preview": {"readonly": True}, - "default": {"readonly": True}, - "orchestrator_type": {"readonly": True}, - "orchestrator_version": {"readonly": True}, + "os_type": {"readonly": True}, + "ready": {"readonly": True}, + "error_message": {"readonly": True}, } _attribute_map = { - "is_preview": {"key": "isPreview", "type": "bool"}, - "default": {"key": "default", "type": "bool"}, - "orchestrator_type": {"key": "orchestratorType", "type": "str"}, - "orchestrator_version": {"key": "orchestratorVersion", "type": "str"}, - "upgrades": {"key": "upgrades", "type": "[OrchestratorProfile]"}, + "os_type": {"key": "osType", "type": "str"}, + "os_sku": {"key": "osSku", "type": "str"}, + "ready": {"key": "ready", "type": "bool"}, + "error_message": {"key": "errorMessage", "type": "str"}, } - def __init__(self, *, upgrades: Optional[List["_models.OrchestratorProfile"]] = None, **kwargs: Any) -> None: + def __init__(self, *, os_sku: Optional[Union[str, "_models.OSSKU"]] = None, **kwargs: Any) -> None: """ - :keyword upgrades: The list of available upgrade versions. - :paramtype upgrades: list[~azure.mgmt.hybridcontainerservice.models.OrchestratorProfile] + :keyword os_sku: Specifies the OS SKU used by the agent pool. The default is CBLMariner if + OSType is Linux. The default is Windows2019 when OSType is Windows. Known values are: + "CBLMariner", "Windows2019", and "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.hybridcontainerservice.models.OSSKU """ super().__init__(**kwargs) - self.is_preview = None - self.default = None - self.orchestrator_type = None - self.orchestrator_version = None - self.upgrades = upgrades - + self.os_type = None + self.os_sku = os_sku + self.ready = None + self.error_message = None -class OrchestratorVersionProfileListResult(_serialization.Model): - """The list of versions for supported orchestrators. - Variables are only populated by the server, and will be ignored when sending a request. +class LinuxProfileProperties(_serialization.Model): + """LinuxProfile - Profile for Linux VMs in the container service cluster. - :ivar orchestrators: Profile of the orchestrator versions. - :vartype orchestrators: - list[~azure.mgmt.hybridcontainerservice.models.OrchestratorVersionProfile] - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str + :ivar ssh: SSH - SSH configuration for Linux-based VMs running on Azure. + :vartype ssh: ~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSsh """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + _attribute_map = { + "ssh": {"key": "ssh", "type": "LinuxProfilePropertiesSsh"}, } + def __init__(self, *, ssh: Optional["_models.LinuxProfilePropertiesSsh"] = None, **kwargs: Any) -> None: + """ + :keyword ssh: SSH - SSH configuration for Linux-based VMs running on Azure. + :paramtype ssh: ~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSsh + """ + super().__init__(**kwargs) + self.ssh = ssh + + +class LinuxProfilePropertiesSsh(_serialization.Model): + """SSH - SSH configuration for Linux-based VMs running on Azure. + + :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with + Linux-based VMs. Only expect one key specified. + :vartype public_keys: + list[~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSshPublicKeysItem] + """ + _attribute_map = { - "orchestrators": {"key": "orchestrators", "type": "[OrchestratorVersionProfile]"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "public_keys": {"key": "publicKeys", "type": "[LinuxProfilePropertiesSshPublicKeysItem]"}, } def __init__( - self, *, orchestrators: Optional[List["_models.OrchestratorVersionProfile"]] = None, **kwargs: Any + self, *, public_keys: Optional[List["_models.LinuxProfilePropertiesSshPublicKeysItem"]] = None, **kwargs: Any ) -> None: """ - :keyword orchestrators: Profile of the orchestrator versions. - :paramtype orchestrators: - list[~azure.mgmt.hybridcontainerservice.models.OrchestratorVersionProfile] + :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with + Linux-based VMs. Only expect one key specified. + :paramtype public_keys: + list[~azure.mgmt.hybridcontainerservice.models.LinuxProfilePropertiesSshPublicKeysItem] """ super().__init__(**kwargs) - self.orchestrators = orchestrators - self.id = None - self.name = None - self.type = None - - -class ProvisionedClusterIdentity(_serialization.Model): - """Identity for the Provisioned cluster. + self.public_keys = public_keys - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class LinuxProfilePropertiesSshPublicKeysItem(_serialization.Model): + """LinuxProfilePropertiesSshPublicKeysItem. - :ivar principal_id: The principal id of provisioned cluster identity. This property will only - be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the provisioned cluster. This property will only - be provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of identity used for the provisioned cluster. The type SystemAssigned, - includes a system created identity. The type None means no identity is assigned to the - provisioned cluster. Required. Known values are: "None" and "SystemAssigned". - :vartype type: str or ~azure.mgmt.hybridcontainerservice.models.ResourceIdentityType + :ivar key_data: KeyData - Certificate public key used to authenticate with VMs through SSH. The + certificate must be in PEM format with or without headers. + :vartype key_data: str """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "key_data": {"key": "keyData", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.ResourceIdentityType"], **kwargs: Any) -> None: + def __init__(self, *, key_data: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword type: The type of identity used for the provisioned cluster. The type SystemAssigned, - includes a system created identity. The type None means no identity is assigned to the - provisioned cluster. Required. Known values are: "None" and "SystemAssigned". - :paramtype type: str or ~azure.mgmt.hybridcontainerservice.models.ResourceIdentityType + :keyword key_data: KeyData - Certificate public key used to authenticate with VMs through SSH. + The certificate must be in PEM format with or without headers. + :paramtype key_data: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + self.key_data = key_data -class ProvisionedClusterPoolUpgradeProfile(_serialization.Model): - """The list of available upgrade versions. +class ListCredentialResponse(_serialization.Model): + """The list kubeconfig result response. Variables are only populated by the server, and will be ignored when sending a request. - :ivar kubernetes_version: The Kubernetes version (major.minor.patch). - :vartype kubernetes_version: str - :ivar name: The Agent Pool name. + :ivar id: Operation Id. + :vartype id: str + :ivar name: Operation Name. :vartype name: str - :ivar os_type: OsType - OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: 'Linux', 'Windows'. Known values are: "Linux" and - "Windows". - :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType - :ivar upgrades: List of orchestrator types and versions available for upgrade. - :vartype upgrades: - list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfileProperties] + :ivar resource_id: ARM Resource Id of the provisioned cluster instance. + :vartype resource_id: str + :ivar status: Provisioning state of the resource. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", "Accepted", and + "Created". + :vartype status: str or ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar error: + :vartype error: ~azure.mgmt.hybridcontainerservice.models.ListCredentialResponseError + :ivar properties: + :vartype properties: ~azure.mgmt.hybridcontainerservice.models.ListCredentialResponseProperties """ _validation = { - "kubernetes_version": {"readonly": True}, + "id": {"readonly": True}, "name": {"readonly": True}, - "os_type": {"readonly": True}, + "resource_id": {"readonly": True}, + "status": {"readonly": True}, } _attribute_map = { - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "upgrades": {"key": "upgrades", "type": "[ProvisionedClusterPoolUpgradeProfileProperties]"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "ListCredentialResponseError"}, + "properties": {"key": "properties", "type": "ListCredentialResponseProperties"}, } def __init__( self, *, - upgrades: Optional[List["_models.ProvisionedClusterPoolUpgradeProfileProperties"]] = None, + error: Optional["_models.ListCredentialResponseError"] = None, + properties: Optional["_models.ListCredentialResponseProperties"] = None, **kwargs: Any ) -> None: """ - :keyword upgrades: List of orchestrator types and versions available for upgrade. - :paramtype upgrades: - list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfileProperties] + :keyword error: + :paramtype error: ~azure.mgmt.hybridcontainerservice.models.ListCredentialResponseError + :keyword properties: + :paramtype properties: + ~azure.mgmt.hybridcontainerservice.models.ListCredentialResponseProperties """ super().__init__(**kwargs) - self.kubernetes_version = None + self.id = None self.name = None - self.os_type = None - self.upgrades = upgrades - + self.resource_id = None + self.status = None + self.error = error + self.properties = properties -class ProvisionedClusterPoolUpgradeProfileProperties(_serialization.Model): - """The upgrade properties. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubernetes_version: The Kubernetes version (major.minor.patch). - :vartype kubernetes_version: str - :ivar is_preview: Whether the Kubernetes version is currently in preview. - :vartype is_preview: bool - """ - - _validation = { - "kubernetes_version": {"readonly": True}, - "is_preview": {"readonly": True}, - } - - _attribute_map = { - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "is_preview": {"key": "isPreview", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubernetes_version = None - self.is_preview = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class ProvisionedClusters(TrackedResource): - """The provisionedClusters resource definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity for the Provisioned cluster. - :vartype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity - :ivar properties: All properties of the provisioned cluster. - :vartype properties: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersAllProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData - :ivar extended_location: - :vartype extended_location: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersExtendedLocation - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ProvisionedClusterIdentity"}, - "properties": {"key": "properties", "type": "ProvisionedClustersAllProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "ProvisionedClustersExtendedLocation"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ProvisionedClusterIdentity"] = None, - properties: Optional["_models.ProvisionedClustersAllProperties"] = None, - extended_location: Optional["_models.ProvisionedClustersExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity for the Provisioned cluster. - :paramtype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity - :keyword properties: All properties of the provisioned cluster. - :paramtype properties: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersAllProperties - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersExtendedLocation - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.properties = properties - self.system_data = None - self.extended_location = extended_location - - -class ProvisionedClustersCommonProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """HybridAKSClusterSpec defines the desired state of HybridAKSCluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :vartype enable_rbac: bool - :ivar linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :vartype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :ivar features: Additional features specs like Arc Agent Onboarding. - :vartype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :ivar addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :vartype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :ivar control_plane: ControlPlane - ControlPlane Configuration. - :vartype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :ivar kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating the - managed cluster. - :vartype kubernetes_version: str - :ivar network_profile: NetworkProfile - Profile of network configuration. - :vartype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :ivar node_resource_group: NodeResourceGroup - Name of the resource group containing agent pool - nodes. - :vartype node_resource_group: str - :ivar agent_pool_profiles: The agent pools of the cluster. - :vartype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Canceled", "InProgress", - "Deleting", "Updating", "Accepted", and "Created". - :vartype provisioning_state: str or ~azure.mgmt.hybridcontainerservice.models.ProvisioningState - :ivar status: HybridAKSClusterStatus defines the observed state of HybridAKSCluster. - :vartype status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatus - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "enable_rbac": {"key": "enableRbac", "type": "bool"}, - "linux_profile": {"key": "linuxProfile", "type": "LinuxProfileProperties"}, - "features": {"key": "features", "type": "ProvisionedClustersCommonPropertiesFeatures"}, - "addon_profiles": {"key": "addonProfiles", "type": "{AddonProfiles}"}, - "control_plane": {"key": "controlPlane", "type": "ControlPlaneProfile"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, - "node_resource_group": {"key": "nodeResourceGroup", "type": "str"}, - "agent_pool_profiles": {"key": "agentPoolProfiles", "type": "[NamedAgentPoolProfile]"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "status": {"key": "status", "type": "ProvisionedClustersCommonPropertiesStatus"}, - } - - def __init__( - self, - *, - enable_rbac: Optional[bool] = None, - linux_profile: Optional["_models.LinuxProfileProperties"] = None, - features: Optional["_models.ProvisionedClustersCommonPropertiesFeatures"] = None, - addon_profiles: Optional[Dict[str, "_models.AddonProfiles"]] = None, - control_plane: Optional["_models.ControlPlaneProfile"] = None, - kubernetes_version: Optional[str] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - node_resource_group: Optional[str] = None, - agent_pool_profiles: Optional[List["_models.NamedAgentPoolProfile"]] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :paramtype enable_rbac: bool - :keyword linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :paramtype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :keyword features: Additional features specs like Arc Agent Onboarding. - :paramtype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :keyword addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :paramtype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :keyword control_plane: ControlPlane - ControlPlane Configuration. - :paramtype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :keyword kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating - the managed cluster. - :paramtype kubernetes_version: str - :keyword network_profile: NetworkProfile - Profile of network configuration. - :paramtype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :keyword node_resource_group: NodeResourceGroup - Name of the resource group containing agent - pool nodes. - :paramtype node_resource_group: str - :keyword agent_pool_profiles: The agent pools of the cluster. - :paramtype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - """ - super().__init__(**kwargs) - self.enable_rbac = enable_rbac - self.linux_profile = linux_profile - self.features = features - self.addon_profiles = addon_profiles - self.control_plane = control_plane - self.kubernetes_version = kubernetes_version - self.network_profile = network_profile - self.node_resource_group = node_resource_group - self.agent_pool_profiles = agent_pool_profiles - self.cloud_provider_profile = cloud_provider_profile - self.provisioning_state = None - self.status = None - - -class ProvisionedClustersPropertiesWithSecrets(_serialization.Model): - """Properties of provisioned clusters that contain secrets. - - :ivar aad_profile: AAD profile for the provisioned cluster. - :vartype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfile - :ivar windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :vartype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfile - :ivar http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :vartype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfig - """ - - _attribute_map = { - "aad_profile": {"key": "aadProfile", "type": "AADProfile"}, - "windows_profile": {"key": "windowsProfile", "type": "WindowsProfile"}, - "http_proxy_config": {"key": "httpProxyConfig", "type": "HttpProxyConfig"}, - } - - def __init__( - self, - *, - aad_profile: Optional["_models.AADProfile"] = None, - windows_profile: Optional["_models.WindowsProfile"] = None, - http_proxy_config: Optional["_models.HttpProxyConfig"] = None, - **kwargs: Any - ) -> None: - """ - :keyword aad_profile: AAD profile for the provisioned cluster. - :paramtype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfile - :keyword windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :paramtype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfile - :keyword http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :paramtype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfig - """ - super().__init__(**kwargs) - self.aad_profile = aad_profile - self.windows_profile = windows_profile - self.http_proxy_config = http_proxy_config - - -class ProvisionedClustersAllProperties( - ProvisionedClustersPropertiesWithSecrets, ProvisionedClustersCommonProperties -): # pylint: disable=too-many-instance-attributes - """All properties of the provisioned cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :vartype enable_rbac: bool - :ivar linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :vartype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :ivar features: Additional features specs like Arc Agent Onboarding. - :vartype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :ivar addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :vartype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :ivar control_plane: ControlPlane - ControlPlane Configuration. - :vartype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :ivar kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating the - managed cluster. - :vartype kubernetes_version: str - :ivar network_profile: NetworkProfile - Profile of network configuration. - :vartype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :ivar node_resource_group: NodeResourceGroup - Name of the resource group containing agent pool - nodes. - :vartype node_resource_group: str - :ivar agent_pool_profiles: The agent pools of the cluster. - :vartype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Canceled", "InProgress", - "Deleting", "Updating", "Accepted", and "Created". - :vartype provisioning_state: str or ~azure.mgmt.hybridcontainerservice.models.ProvisioningState - :ivar status: HybridAKSClusterStatus defines the observed state of HybridAKSCluster. - :vartype status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatus - :ivar aad_profile: AAD profile for the provisioned cluster. - :vartype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfile - :ivar windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :vartype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfile - :ivar http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :vartype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfig - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "enable_rbac": {"key": "enableRbac", "type": "bool"}, - "linux_profile": {"key": "linuxProfile", "type": "LinuxProfileProperties"}, - "features": {"key": "features", "type": "ProvisionedClustersCommonPropertiesFeatures"}, - "addon_profiles": {"key": "addonProfiles", "type": "{AddonProfiles}"}, - "control_plane": {"key": "controlPlane", "type": "ControlPlaneProfile"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, - "node_resource_group": {"key": "nodeResourceGroup", "type": "str"}, - "agent_pool_profiles": {"key": "agentPoolProfiles", "type": "[NamedAgentPoolProfile]"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "status": {"key": "status", "type": "ProvisionedClustersCommonPropertiesStatus"}, - "aad_profile": {"key": "aadProfile", "type": "AADProfile"}, - "windows_profile": {"key": "windowsProfile", "type": "WindowsProfile"}, - "http_proxy_config": {"key": "httpProxyConfig", "type": "HttpProxyConfig"}, - } - - def __init__( - self, - *, - enable_rbac: Optional[bool] = None, - linux_profile: Optional["_models.LinuxProfileProperties"] = None, - features: Optional["_models.ProvisionedClustersCommonPropertiesFeatures"] = None, - addon_profiles: Optional[Dict[str, "_models.AddonProfiles"]] = None, - control_plane: Optional["_models.ControlPlaneProfile"] = None, - kubernetes_version: Optional[str] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - node_resource_group: Optional[str] = None, - agent_pool_profiles: Optional[List["_models.NamedAgentPoolProfile"]] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, - aad_profile: Optional["_models.AADProfile"] = None, - windows_profile: Optional["_models.WindowsProfile"] = None, - http_proxy_config: Optional["_models.HttpProxyConfig"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :paramtype enable_rbac: bool - :keyword linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :paramtype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :keyword features: Additional features specs like Arc Agent Onboarding. - :paramtype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :keyword addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :paramtype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :keyword control_plane: ControlPlane - ControlPlane Configuration. - :paramtype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :keyword kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating - the managed cluster. - :paramtype kubernetes_version: str - :keyword network_profile: NetworkProfile - Profile of network configuration. - :paramtype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :keyword node_resource_group: NodeResourceGroup - Name of the resource group containing agent - pool nodes. - :paramtype node_resource_group: str - :keyword agent_pool_profiles: The agent pools of the cluster. - :paramtype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :keyword aad_profile: AAD profile for the provisioned cluster. - :paramtype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfile - :keyword windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :paramtype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfile - :keyword http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :paramtype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfig - """ - super().__init__( - aad_profile=aad_profile, - windows_profile=windows_profile, - http_proxy_config=http_proxy_config, - enable_rbac=enable_rbac, - linux_profile=linux_profile, - features=features, - addon_profiles=addon_profiles, - control_plane=control_plane, - kubernetes_version=kubernetes_version, - network_profile=network_profile, - node_resource_group=node_resource_group, - agent_pool_profiles=agent_pool_profiles, - cloud_provider_profile=cloud_provider_profile, - **kwargs - ) - self.enable_rbac = enable_rbac - self.linux_profile = linux_profile - self.features = features - self.addon_profiles = addon_profiles - self.control_plane = control_plane - self.kubernetes_version = kubernetes_version - self.network_profile = network_profile - self.node_resource_group = node_resource_group - self.agent_pool_profiles = agent_pool_profiles - self.cloud_provider_profile = cloud_provider_profile - self.provisioning_state = None - self.status = None - self.aad_profile = aad_profile - self.windows_profile = windows_profile - self.http_proxy_config = http_proxy_config - - -class ProvisionedClustersCommonPropertiesFeatures(_serialization.Model): - """Additional features specs like Arc Agent Onboarding. - - :ivar arc_agent_profile: Arc agentry configuration for the provisioned cluster. - :vartype arc_agent_profile: ~azure.mgmt.hybridcontainerservice.models.ArcAgentProfile - """ - - _attribute_map = { - "arc_agent_profile": {"key": "arcAgentProfile", "type": "ArcAgentProfile"}, - } - - def __init__(self, *, arc_agent_profile: Optional["_models.ArcAgentProfile"] = None, **kwargs: Any) -> None: - """ - :keyword arc_agent_profile: Arc agentry configuration for the provisioned cluster. - :paramtype arc_agent_profile: ~azure.mgmt.hybridcontainerservice.models.ArcAgentProfile - """ - super().__init__(**kwargs) - self.arc_agent_profile = arc_agent_profile - - -class ProvisionedClustersCommonPropertiesStatus(_serialization.Model): - """HybridAKSClusterStatus defines the observed state of HybridAKSCluster. - - :ivar features_status: Additional features status like Arc Agent Onboarding. - :vartype features_status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusFeaturesStatus - :ivar addon_status: AddonStatus - Status of Addons. - :vartype addon_status: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonStatus] - :ivar error_message: ErrorMessage - Error messages during creation of cluster. - :vartype error_message: str - :ivar provisioning_status: Contains Provisioning errors. - :vartype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusProvisioningStatus - """ - - _attribute_map = { - "features_status": {"key": "featuresStatus", "type": "ProvisionedClustersCommonPropertiesStatusFeaturesStatus"}, - "addon_status": {"key": "addonStatus", "type": "{AddonStatus}"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "provisioning_status": { - "key": "provisioningStatus", - "type": "ProvisionedClustersCommonPropertiesStatusProvisioningStatus", - }, - } - - def __init__( - self, - *, - features_status: Optional["_models.ProvisionedClustersCommonPropertiesStatusFeaturesStatus"] = None, - addon_status: Optional[Dict[str, "_models.AddonStatus"]] = None, - error_message: Optional[str] = None, - provisioning_status: Optional["_models.ProvisionedClustersCommonPropertiesStatusProvisioningStatus"] = None, - **kwargs: Any - ) -> None: - """ - :keyword features_status: Additional features status like Arc Agent Onboarding. - :paramtype features_status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusFeaturesStatus - :keyword addon_status: AddonStatus - Status of Addons. - :paramtype addon_status: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonStatus] - :keyword error_message: ErrorMessage - Error messages during creation of cluster. - :paramtype error_message: str - :keyword provisioning_status: Contains Provisioning errors. - :paramtype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusProvisioningStatus - """ - super().__init__(**kwargs) - self.features_status = features_status - self.addon_status = addon_status - self.error_message = error_message - self.provisioning_status = provisioning_status - - -class ProvisionedClustersCommonPropertiesStatusFeaturesStatus(_serialization.Model): - """Additional features status like Arc Agent Onboarding. - - :ivar arc_agent_status: Defines the observed Arc Agent status that is resourceSynced back to - the ARM resource. - :vartype arc_agent_status: ~azure.mgmt.hybridcontainerservice.models.ArcAgentStatus - """ - - _attribute_map = { - "arc_agent_status": {"key": "arcAgentStatus", "type": "ArcAgentStatus"}, - } - - def __init__(self, *, arc_agent_status: Optional["_models.ArcAgentStatus"] = None, **kwargs: Any) -> None: - """ - :keyword arc_agent_status: Defines the observed Arc Agent status that is resourceSynced back to - the ARM resource. - :paramtype arc_agent_status: ~azure.mgmt.hybridcontainerservice.models.ArcAgentStatus - """ - super().__init__(**kwargs) - self.arc_agent_status = arc_agent_status - - -class ProvisionedClustersCommonPropertiesStatusProvisioningStatus(_serialization.Model): - """Contains Provisioning errors. - - :ivar error: - :vartype error: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusProvisioningStatusError - :ivar operation_id: - :vartype operation_id: str - :ivar phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :vartype phase: str - :ivar status: - :vartype status: str - """ - - _attribute_map = { - "error": {"key": "error", "type": "ProvisionedClustersCommonPropertiesStatusProvisioningStatusError"}, - "operation_id": {"key": "operationId", "type": "str"}, - "phase": {"key": "phase", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - error: Optional["_models.ProvisionedClustersCommonPropertiesStatusProvisioningStatusError"] = None, - operation_id: Optional[str] = None, - phase: Optional[str] = None, - status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword error: - :paramtype error: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatusProvisioningStatusError - :keyword operation_id: - :paramtype operation_id: str - :keyword phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :paramtype phase: str - :keyword status: - :paramtype status: str - """ - super().__init__(**kwargs) - self.error = error - self.operation_id = operation_id - self.phase = phase - self.status = status - - -class ProvisionedClustersCommonPropertiesStatusProvisioningStatusError(_serialization.Model): - """ProvisionedClustersCommonPropertiesStatusProvisioningStatusError. +class ListCredentialResponseError(_serialization.Model): + """ListCredentialResponseError. :ivar code: :vartype code: str @@ -3105,909 +1651,507 @@ class ProvisionedClustersCommonPropertiesStatusProvisioningStatusError(_serializ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword code: - :paramtype code: str - :keyword message: - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ProvisionedClustersExtendedLocation(_serialization.Model): - """ProvisionedClustersExtendedLocation. - - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class ProvisionedClustersPatch(_serialization.Model): - """The provisionedClusters resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ProvisionedClustersPropertiesWithoutSecrets(_serialization.Model): - """Properties of provisioned clusters without the corresponding secrets. - - :ivar aad_profile: AAD profile for the provisioned cluster. - :vartype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfileResponse - :ivar windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :vartype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfileResponse - :ivar http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :vartype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfigResponse - """ - - _attribute_map = { - "aad_profile": {"key": "aadProfile", "type": "AADProfileResponse"}, - "windows_profile": {"key": "windowsProfile", "type": "WindowsProfileResponse"}, - "http_proxy_config": {"key": "httpProxyConfig", "type": "HttpProxyConfigResponse"}, - } - - def __init__( - self, - *, - aad_profile: Optional["_models.AADProfileResponse"] = None, - windows_profile: Optional["_models.WindowsProfileResponse"] = None, - http_proxy_config: Optional["_models.HttpProxyConfigResponse"] = None, - **kwargs: Any - ) -> None: - """ - :keyword aad_profile: AAD profile for the provisioned cluster. - :paramtype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfileResponse - :keyword windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :paramtype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfileResponse - :keyword http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :paramtype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfigResponse - """ - super().__init__(**kwargs) - self.aad_profile = aad_profile - self.windows_profile = windows_profile - self.http_proxy_config = http_proxy_config - - -class ProvisionedClustersResponse(TrackedResource): - """The provisionedClusters resource definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity for the Provisioned cluster. - :vartype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity - :ivar properties: - :vartype properties: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponseProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData - :ivar extended_location: - :vartype extended_location: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponseExtendedLocation - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ProvisionedClusterIdentity"}, - "properties": {"key": "properties", "type": "ProvisionedClustersResponseProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "ProvisionedClustersResponseExtendedLocation"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ProvisionedClusterIdentity"] = None, - properties: Optional["_models.ProvisionedClustersResponseProperties"] = None, - extended_location: Optional["_models.ProvisionedClustersResponseExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity for the Provisioned cluster. - :paramtype identity: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterIdentity - :keyword properties: - :paramtype properties: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponseProperties - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponseExtendedLocation - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.properties = properties - self.system_data = None - self.extended_location = extended_location - - -class ProvisionedClustersResponseExtendedLocation(_serialization.Model): - """ProvisionedClustersResponseExtendedLocation. - - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class ProvisionedClustersResponseListResult(_serialization.Model): - """ProvisionedClustersResponseListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProvisionedClustersResponse]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ProvisionedClustersResponse"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProvisionedClustersResponseProperties( - ProvisionedClustersPropertiesWithoutSecrets, ProvisionedClustersCommonProperties -): # pylint: disable=too-many-instance-attributes - """ProvisionedClustersResponseProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :vartype enable_rbac: bool - :ivar linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :vartype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :ivar features: Additional features specs like Arc Agent Onboarding. - :vartype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :ivar addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :vartype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :ivar control_plane: ControlPlane - ControlPlane Configuration. - :vartype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :ivar kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating the - managed cluster. - :vartype kubernetes_version: str - :ivar network_profile: NetworkProfile - Profile of network configuration. - :vartype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :ivar node_resource_group: NodeResourceGroup - Name of the resource group containing agent pool - nodes. - :vartype node_resource_group: str - :ivar agent_pool_profiles: The agent pools of the cluster. - :vartype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :ivar cloud_provider_profile: The underlying cloud infra provider properties. - :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Canceled", "InProgress", - "Deleting", "Updating", "Accepted", and "Created". - :vartype provisioning_state: str or ~azure.mgmt.hybridcontainerservice.models.ProvisioningState - :ivar status: HybridAKSClusterStatus defines the observed state of HybridAKSCluster. - :vartype status: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesStatus - :ivar aad_profile: AAD profile for the provisioned cluster. - :vartype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfileResponse - :ivar windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :vartype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfileResponse - :ivar http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :vartype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfigResponse - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "enable_rbac": {"key": "enableRbac", "type": "bool"}, - "linux_profile": {"key": "linuxProfile", "type": "LinuxProfileProperties"}, - "features": {"key": "features", "type": "ProvisionedClustersCommonPropertiesFeatures"}, - "addon_profiles": {"key": "addonProfiles", "type": "{AddonProfiles}"}, - "control_plane": {"key": "controlPlane", "type": "ControlPlaneProfile"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, - "node_resource_group": {"key": "nodeResourceGroup", "type": "str"}, - "agent_pool_profiles": {"key": "agentPoolProfiles", "type": "[NamedAgentPoolProfile]"}, - "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "status": {"key": "status", "type": "ProvisionedClustersCommonPropertiesStatus"}, - "aad_profile": {"key": "aadProfile", "type": "AADProfileResponse"}, - "windows_profile": {"key": "windowsProfile", "type": "WindowsProfileResponse"}, - "http_proxy_config": {"key": "httpProxyConfig", "type": "HttpProxyConfigResponse"}, - } - - def __init__( - self, - *, - enable_rbac: Optional[bool] = None, - linux_profile: Optional["_models.LinuxProfileProperties"] = None, - features: Optional["_models.ProvisionedClustersCommonPropertiesFeatures"] = None, - addon_profiles: Optional[Dict[str, "_models.AddonProfiles"]] = None, - control_plane: Optional["_models.ControlPlaneProfile"] = None, - kubernetes_version: Optional[str] = None, - network_profile: Optional["_models.NetworkProfile"] = None, - node_resource_group: Optional[str] = None, - agent_pool_profiles: Optional[List["_models.NamedAgentPoolProfile"]] = None, - cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, - aad_profile: Optional["_models.AADProfileResponse"] = None, - windows_profile: Optional["_models.WindowsProfileResponse"] = None, - http_proxy_config: Optional["_models.HttpProxyConfigResponse"] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_rbac: EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - :paramtype enable_rbac: bool - :keyword linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. - :paramtype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties - :keyword features: Additional features specs like Arc Agent Onboarding. - :paramtype features: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures - :keyword addon_profiles: AddonProfiles - Profile of managed cluster add-on. - :paramtype addon_profiles: dict[str, ~azure.mgmt.hybridcontainerservice.models.AddonProfiles] - :keyword control_plane: ControlPlane - ControlPlane Configuration. - :paramtype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile - :keyword kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating - the managed cluster. - :paramtype kubernetes_version: str - :keyword network_profile: NetworkProfile - Profile of network configuration. - :paramtype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile - :keyword node_resource_group: NodeResourceGroup - Name of the resource group containing agent - pool nodes. - :paramtype node_resource_group: str - :keyword agent_pool_profiles: The agent pools of the cluster. - :paramtype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] - :keyword cloud_provider_profile: The underlying cloud infra provider properties. - :paramtype cloud_provider_profile: - ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile - :keyword aad_profile: AAD profile for the provisioned cluster. - :paramtype aad_profile: ~azure.mgmt.hybridcontainerservice.models.AADProfileResponse - :keyword windows_profile: WindowsProfile - Profile for Windows VMs in the Provisioned Cluster. - :paramtype windows_profile: ~azure.mgmt.hybridcontainerservice.models.WindowsProfileResponse - :keyword http_proxy_config: HttpProxyConfig - Configurations for provisioning the cluster with - HTTP proxy servers. - :paramtype http_proxy_config: ~azure.mgmt.hybridcontainerservice.models.HttpProxyConfigResponse + :keyword code: + :paramtype code: str + :keyword message: + :paramtype message: str """ - super().__init__( - aad_profile=aad_profile, - windows_profile=windows_profile, - http_proxy_config=http_proxy_config, - enable_rbac=enable_rbac, - linux_profile=linux_profile, - features=features, - addon_profiles=addon_profiles, - control_plane=control_plane, - kubernetes_version=kubernetes_version, - network_profile=network_profile, - node_resource_group=node_resource_group, - agent_pool_profiles=agent_pool_profiles, - cloud_provider_profile=cloud_provider_profile, - **kwargs - ) - self.enable_rbac = enable_rbac - self.linux_profile = linux_profile - self.features = features - self.addon_profiles = addon_profiles - self.control_plane = control_plane - self.kubernetes_version = kubernetes_version - self.network_profile = network_profile - self.node_resource_group = node_resource_group - self.agent_pool_profiles = agent_pool_profiles - self.cloud_provider_profile = cloud_provider_profile - self.provisioning_state = None - self.status = None - self.aad_profile = aad_profile - self.windows_profile = windows_profile - self.http_proxy_config = http_proxy_config + super().__init__(**kwargs) + self.code = code + self.message = message -class ProvisionedClusterUpgradeProfile(ProxyResource): - """The list of available upgrades for compute pools. +class ListCredentialResponseProperties(_serialization.Model): + """ListCredentialResponseProperties. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar provisioning_state: - :vartype provisioning_state: str - :ivar control_plane_profile: The list of available upgrade versions for the control plane. - Required. - :vartype control_plane_profile: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile - :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. - :vartype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile] + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: list[~azure.mgmt.hybridcontainerservice.models.CredentialResult] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "control_plane_profile": {"required": True}, - "agent_pool_profiles": {"required": True}, + "kubeconfigs": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "control_plane_profile": { - "key": "properties.controlPlaneProfile", - "type": "ProvisionedClusterPoolUpgradeProfile", - }, - "agent_pool_profiles": { - "key": "properties.agentPoolProfiles", - "type": "[ProvisionedClusterPoolUpgradeProfile]", - }, + "kubeconfigs": {"key": "kubeconfigs", "type": "[CredentialResult]"}, } - def __init__( - self, - *, - control_plane_profile: "_models.ProvisionedClusterPoolUpgradeProfile", - agent_pool_profiles: List["_models.ProvisionedClusterPoolUpgradeProfile"], - **kwargs: Any - ) -> None: - """ - :keyword control_plane_profile: The list of available upgrade versions for the control plane. - Required. - :paramtype control_plane_profile: - ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile - :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. - :paramtype agent_pool_profiles: - list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.control_plane_profile = control_plane_profile - self.agent_pool_profiles = agent_pool_profiles + self.kubeconfigs = None -class ResourceProviderOperation(_serialization.Model): - """Results of the request to list operations. +class NetworkProfile(_serialization.Model): + """NetworkProfile - Profile of network configuration. - :ivar is_data_action: Indicates whether the operation applies to data-plane. - :vartype is_data_action: str - :ivar name: Operation name, in format of {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Display metadata associated with the operation. - :vartype display: ~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperationDisplay + :ivar load_balancer_profile: LoadBalancerProfile - Profile of the cluster load balancer. + :vartype load_balancer_profile: + ~azure.mgmt.hybridcontainerservice.models.NetworkProfileLoadBalancerProfile + :ivar network_policy: NetworkPolicy - Network policy used for building Kubernetes network. + Possible values include: 'calico', 'flannel'. Default is 'calico'. Known values are: "calico" + and "flannel". + :vartype network_policy: str or ~azure.mgmt.hybridcontainerservice.models.NetworkPolicy + :ivar pod_cidr: PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is + used. + :vartype pod_cidr: str """ _attribute_map = { - "is_data_action": {"key": "isDataAction", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "ResourceProviderOperationDisplay"}, + "load_balancer_profile": {"key": "loadBalancerProfile", "type": "NetworkProfileLoadBalancerProfile"}, + "network_policy": {"key": "networkPolicy", "type": "str"}, + "pod_cidr": {"key": "podCidr", "type": "str"}, } def __init__( self, *, - is_data_action: Optional[str] = None, - name: Optional[str] = None, - display: Optional["_models.ResourceProviderOperationDisplay"] = None, + load_balancer_profile: Optional["_models.NetworkProfileLoadBalancerProfile"] = None, + network_policy: Union[str, "_models.NetworkPolicy"] = "calico", + pod_cidr: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword is_data_action: Indicates whether the operation applies to data-plane. - :paramtype is_data_action: str - :keyword name: Operation name, in format of {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display metadata associated with the operation. - :paramtype display: ~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperationDisplay + :keyword load_balancer_profile: LoadBalancerProfile - Profile of the cluster load balancer. + :paramtype load_balancer_profile: + ~azure.mgmt.hybridcontainerservice.models.NetworkProfileLoadBalancerProfile + :keyword network_policy: NetworkPolicy - Network policy used for building Kubernetes network. + Possible values include: 'calico', 'flannel'. Default is 'calico'. Known values are: "calico" + and "flannel". + :paramtype network_policy: str or ~azure.mgmt.hybridcontainerservice.models.NetworkPolicy + :keyword pod_cidr: PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet + is used. + :paramtype pod_cidr: str """ super().__init__(**kwargs) - self.is_data_action = is_data_action - self.name = name - self.display = display + self.load_balancer_profile = load_balancer_profile + self.network_policy = network_policy + self.pod_cidr = pod_cidr -class ResourceProviderOperationDisplay(_serialization.Model): - """Display metadata associated with the operation. +class NetworkProfileLoadBalancerProfile(_serialization.Model): + """LoadBalancerProfile - Profile of the cluster load balancer. - :ivar provider: The resource provider. - :vartype provider: str - :ivar resource: Resource on which the operation is performed. - :vartype resource: str - :ivar operation: Type of operation: get, read, delete, etc. - :vartype operation: str - :ivar description: Description of this operation. - :vartype description: str + :ivar count: Count - Number of load balancer VMs. The default value is 0. + :vartype count: int """ _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "count": {"key": "count", "type": "int"}, } - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, count: int = 0, **kwargs: Any) -> None: """ - :keyword provider: The resource provider. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed. - :paramtype resource: str - :keyword operation: Type of operation: get, read, delete, etc. - :paramtype operation: str - :keyword description: Description of this operation. - :paramtype description: str + :keyword count: Count - Number of load balancer VMs. The default value is 0. + :paramtype count: int """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.count = count -class ResourceProviderOperationList(_serialization.Model): - """Results of the request to list operations. +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - :ivar value: - :vartype value: list[~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperation] - :ivar next_link: - :vartype next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.hybridcontainerservice.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.hybridcontainerservice.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.hybridcontainerservice.models.ActionType """ + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[ResourceProviderOperation]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ResourceProviderOperation"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ - :keyword value: - :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperation] - :keyword next_link: - :paramtype next_link: str + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.hybridcontainerservice.models.OperationDisplay """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None -class StorageSpaces(TrackedResource): - """The storageSpaces resource definition. +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: HybridAKSStorageSpec defines the desired state of HybridAKSStorage. - :vartype properties: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData - :ivar extended_location: - :vartype extended_location: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesExtendedLocation + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "StorageSpacesProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "StorageSpacesExtendedLocation"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.StorageSpacesProperties"] = None, - extended_location: Optional["_models.StorageSpacesExtendedLocation"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: HybridAKSStorageSpec defines the desired state of HybridAKSStorage. - :paramtype properties: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesProperties - :keyword extended_location: - :paramtype extended_location: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesExtendedLocation - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - self.system_data = None - self.extended_location = extended_location + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class StorageSpacesExtendedLocation(_serialization.Model): - """StorageSpacesExtendedLocation. +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. - :ivar type: The extended location type. - :vartype type: str - :ivar name: The extended location name. - :vartype name: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.hybridcontainerservice.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword type: The extended location type. - :paramtype type: str - :keyword name: The extended location name. - :paramtype name: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.type = type - self.name = name + self.value = None + self.next_link = None -class StorageSpacesListResult(_serialization.Model): - """StorageSpacesListResult. +class ProvisionedClusterLicenseProfile(_serialization.Model): + """The license profile of the provisioned cluster. - :ivar value: - :vartype value: list[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :ivar next_link: - :vartype next_link: str + :ivar azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :vartype azure_hybrid_benefit: str or + ~azure.mgmt.hybridcontainerservice.models.AzureHybridBenefit """ _attribute_map = { - "value": {"key": "value", "type": "[StorageSpaces]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "azure_hybrid_benefit": {"key": "azureHybridBenefit", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.StorageSpaces"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, azure_hybrid_benefit: Union[str, "_models.AzureHybridBenefit"] = "NotApplicable", **kwargs: Any ) -> None: """ - :keyword value: - :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :keyword next_link: - :paramtype next_link: str + :keyword azure_hybrid_benefit: Indicates whether Azure Hybrid Benefit is opted in. Known values + are: "True", "False", and "NotApplicable". + :paramtype azure_hybrid_benefit: str or + ~azure.mgmt.hybridcontainerservice.models.AzureHybridBenefit """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.azure_hybrid_benefit = azure_hybrid_benefit + +class ProvisionedClusterPoolUpgradeProfile(_serialization.Model): + """The list of available upgrade versions. -class StorageSpacesPatch(_serialization.Model): - """The storageSpaces resource patch definition. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar name: The Agent Pool name. + :vartype name: str + :ivar os_type: The particular KubernetesVersion's Image's OS Type (Linux, Windows). Known + values are: "Windows" and "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcontainerservice.models.OsType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfileProperties] """ + _validation = { + "kubernetes_version": {"readonly": True}, + "name": {"readonly": True}, + "os_type": {"readonly": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "upgrades": {"key": "upgrades", "type": "[ProvisionedClusterPoolUpgradeProfileProperties]"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + upgrades: Optional[List["_models.ProvisionedClusterPoolUpgradeProfileProperties"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfileProperties] """ super().__init__(**kwargs) - self.tags = tags + self.kubernetes_version = None + self.name = None + self.os_type = None + self.upgrades = upgrades -class StorageSpacesProperties(_serialization.Model): - """HybridAKSStorageSpec defines the desired state of HybridAKSStorage. +class ProvisionedClusterPoolUpgradeProfileProperties(_serialization.Model): + """The upgrade properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar hci_storage_profile: - :vartype hci_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesHciStorageProfile - :ivar vmware_storage_profile: - :vartype vmware_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesVmwareStorageProfile - :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Canceled", "InProgress", - "Deleting", "Updating", "Accepted", and "Created". - :vartype provisioning_state: str or ~azure.mgmt.hybridcontainerservice.models.ProvisioningState - :ivar status: HybridAKSStorageStatus defines the observed state of HybridAKSStorage. - :vartype status: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatus + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether the Kubernetes version is currently in preview. + :vartype is_preview: bool """ _validation = { - "provisioning_state": {"readonly": True}, + "kubernetes_version": {"readonly": True}, + "is_preview": {"readonly": True}, } _attribute_map = { - "hci_storage_profile": {"key": "hciStorageProfile", "type": "StorageSpacesPropertiesHciStorageProfile"}, - "vmware_storage_profile": { - "key": "vmwareStorageProfile", - "type": "StorageSpacesPropertiesVmwareStorageProfile", - }, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "status": {"key": "status", "type": "StorageSpacesPropertiesStatus"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "is_preview": {"key": "isPreview", "type": "bool"}, } - def __init__( - self, - *, - hci_storage_profile: Optional["_models.StorageSpacesPropertiesHciStorageProfile"] = None, - vmware_storage_profile: Optional["_models.StorageSpacesPropertiesVmwareStorageProfile"] = None, - status: Optional["_models.StorageSpacesPropertiesStatus"] = None, - **kwargs: Any - ) -> None: - """ - :keyword hci_storage_profile: - :paramtype hci_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesHciStorageProfile - :keyword vmware_storage_profile: - :paramtype vmware_storage_profile: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesVmwareStorageProfile - :keyword status: HybridAKSStorageStatus defines the observed state of HybridAKSStorage. - :paramtype status: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatus - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.hci_storage_profile = hci_storage_profile - self.vmware_storage_profile = vmware_storage_profile - self.provisioning_state = None - self.status = status + self.kubernetes_version = None + self.is_preview = None -class StorageSpacesPropertiesHciStorageProfile(_serialization.Model): - """StorageSpacesPropertiesHciStorageProfile. +class ProvisionedClusterProperties(_serialization.Model): + """All properties of the provisioned cluster. - :ivar moc_group: Resource group in MOC(Microsoft On-premises Cloud). - :vartype moc_group: str - :ivar moc_location: Location in MOC(Microsoft On-premises Cloud). - :vartype moc_location: str - :ivar moc_storage_container: Name of the storage container in MOC(Microsoft On-premises Cloud). - :vartype moc_storage_container: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. + :vartype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties + :ivar control_plane: ControlPlane - ControlPlane Configuration. + :vartype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile + :ivar kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating the + managed cluster. + :vartype kubernetes_version: str + :ivar network_profile: NetworkProfile - Profile of network configuration. + :vartype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile + :ivar agent_pool_profiles: The agent pools of the cluster. + :vartype agent_pool_profiles: + list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] + :ivar cloud_provider_profile: The underlying cloud infra provider properties. + :vartype cloud_provider_profile: ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". + :vartype provisioning_state: str or + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar status: HybridAKSClusterStatus defines the observed state of HybridAKSCluster. + :vartype status: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPropertiesStatus + :ivar license_profile: The license profile of the provisioned cluster. + :vartype license_profile: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterLicenseProfile """ + _validation = { + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + } + _attribute_map = { - "moc_group": {"key": "mocGroup", "type": "str"}, - "moc_location": {"key": "mocLocation", "type": "str"}, - "moc_storage_container": {"key": "mocStorageContainer", "type": "str"}, + "linux_profile": {"key": "linuxProfile", "type": "LinuxProfileProperties"}, + "control_plane": {"key": "controlPlane", "type": "ControlPlaneProfile"}, + "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, + "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, + "agent_pool_profiles": {"key": "agentPoolProfiles", "type": "[NamedAgentPoolProfile]"}, + "cloud_provider_profile": {"key": "cloudProviderProfile", "type": "CloudProviderProfile"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "status": {"key": "status", "type": "ProvisionedClusterPropertiesStatus"}, + "license_profile": {"key": "licenseProfile", "type": "ProvisionedClusterLicenseProfile"}, } def __init__( self, *, - moc_group: Optional[str] = None, - moc_location: Optional[str] = None, - moc_storage_container: Optional[str] = None, + linux_profile: Optional["_models.LinuxProfileProperties"] = None, + control_plane: Optional["_models.ControlPlaneProfile"] = None, + kubernetes_version: Optional[str] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + agent_pool_profiles: Optional[List["_models.NamedAgentPoolProfile"]] = None, + cloud_provider_profile: Optional["_models.CloudProviderProfile"] = None, + license_profile: Optional["_models.ProvisionedClusterLicenseProfile"] = None, **kwargs: Any ) -> None: """ - :keyword moc_group: Resource group in MOC(Microsoft On-premises Cloud). - :paramtype moc_group: str - :keyword moc_location: Location in MOC(Microsoft On-premises Cloud). - :paramtype moc_location: str - :keyword moc_storage_container: Name of the storage container in MOC(Microsoft On-premises - Cloud). - :paramtype moc_storage_container: str + :keyword linux_profile: LinuxProfile - The profile for Linux VMs in the Provisioned Cluster. + :paramtype linux_profile: ~azure.mgmt.hybridcontainerservice.models.LinuxProfileProperties + :keyword control_plane: ControlPlane - ControlPlane Configuration. + :paramtype control_plane: ~azure.mgmt.hybridcontainerservice.models.ControlPlaneProfile + :keyword kubernetes_version: KubernetesVersion - Version of Kubernetes specified when creating + the managed cluster. + :paramtype kubernetes_version: str + :keyword network_profile: NetworkProfile - Profile of network configuration. + :paramtype network_profile: ~azure.mgmt.hybridcontainerservice.models.NetworkProfile + :keyword agent_pool_profiles: The agent pools of the cluster. + :paramtype agent_pool_profiles: + list[~azure.mgmt.hybridcontainerservice.models.NamedAgentPoolProfile] + :keyword cloud_provider_profile: The underlying cloud infra provider properties. + :paramtype cloud_provider_profile: + ~azure.mgmt.hybridcontainerservice.models.CloudProviderProfile + :keyword license_profile: The license profile of the provisioned cluster. + :paramtype license_profile: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterLicenseProfile """ super().__init__(**kwargs) - self.moc_group = moc_group - self.moc_location = moc_location - self.moc_storage_container = moc_storage_container + self.linux_profile = linux_profile + self.control_plane = control_plane + self.kubernetes_version = kubernetes_version + self.network_profile = network_profile + self.agent_pool_profiles = agent_pool_profiles + self.cloud_provider_profile = cloud_provider_profile + self.provisioning_state = None + self.status = None + self.license_profile = license_profile -class StorageSpacesPropertiesStatus(_serialization.Model): - """HybridAKSStorageStatus defines the observed state of HybridAKSStorage. +class ProvisionedClusterPropertiesStatus(_serialization.Model): + """HybridAKSClusterStatus defines the observed state of HybridAKSCluster. - :ivar provisioning_status: Contains Provisioning errors. - :vartype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatusProvisioningStatus + :ivar control_plane_status: Status of the control plane components. + :vartype control_plane_status: + list[~azure.mgmt.hybridcontainerservice.models.AddonStatusProfile] + :ivar error_message: ErrorMessage - Error messages during creation of cluster. + :vartype error_message: str + :ivar operation_status: Contains Provisioning errors. + :vartype operation_status: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPropertiesStatusOperationStatus """ _attribute_map = { - "provisioning_status": {"key": "provisioningStatus", "type": "StorageSpacesPropertiesStatusProvisioningStatus"}, + "control_plane_status": {"key": "controlPlaneStatus", "type": "[AddonStatusProfile]"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "operation_status": {"key": "operationStatus", "type": "ProvisionedClusterPropertiesStatusOperationStatus"}, } def __init__( self, *, - provisioning_status: Optional["_models.StorageSpacesPropertiesStatusProvisioningStatus"] = None, + control_plane_status: Optional[List["_models.AddonStatusProfile"]] = None, + error_message: Optional[str] = None, + operation_status: Optional["_models.ProvisionedClusterPropertiesStatusOperationStatus"] = None, **kwargs: Any ) -> None: """ - :keyword provisioning_status: Contains Provisioning errors. - :paramtype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatusProvisioningStatus + :keyword control_plane_status: Status of the control plane components. + :paramtype control_plane_status: + list[~azure.mgmt.hybridcontainerservice.models.AddonStatusProfile] + :keyword error_message: ErrorMessage - Error messages during creation of cluster. + :paramtype error_message: str + :keyword operation_status: Contains Provisioning errors. + :paramtype operation_status: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPropertiesStatusOperationStatus """ super().__init__(**kwargs) - self.provisioning_status = provisioning_status + self.control_plane_status = control_plane_status + self.error_message = error_message + self.operation_status = operation_status -class StorageSpacesPropertiesStatusProvisioningStatus(_serialization.Model): +class ProvisionedClusterPropertiesStatusOperationStatus(_serialization.Model): """Contains Provisioning errors. :ivar error: :vartype error: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatusProvisioningStatusError + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPropertiesStatusOperationStatusError :ivar operation_id: :vartype operation_id: str - :ivar phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :vartype phase: str :ivar status: :vartype status: str """ _attribute_map = { - "error": {"key": "error", "type": "StorageSpacesPropertiesStatusProvisioningStatusError"}, + "error": {"key": "error", "type": "ProvisionedClusterPropertiesStatusOperationStatusError"}, "operation_id": {"key": "operationId", "type": "str"}, - "phase": {"key": "phase", "type": "str"}, "status": {"key": "status", "type": "str"}, } def __init__( self, *, - error: Optional["_models.StorageSpacesPropertiesStatusProvisioningStatusError"] = None, + error: Optional["_models.ProvisionedClusterPropertiesStatusOperationStatusError"] = None, operation_id: Optional[str] = None, - phase: Optional[str] = None, status: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword error: :paramtype error: - ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPropertiesStatusProvisioningStatusError + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPropertiesStatusOperationStatusError :keyword operation_id: :paramtype operation_id: str - :keyword phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. - :paramtype phase: str :keyword status: :paramtype status: str """ super().__init__(**kwargs) self.error = error self.operation_id = operation_id - self.phase = phase self.status = status -class StorageSpacesPropertiesStatusProvisioningStatusError(_serialization.Model): - """StorageSpacesPropertiesStatusProvisioningStatusError. +class ProvisionedClusterPropertiesStatusOperationStatusError(_serialization.Model): + """ProvisionedClusterPropertiesStatusOperationStatusError. :ivar code: :vartype code: str @@ -4032,50 +2176,172 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message -class StorageSpacesPropertiesVmwareStorageProfile(_serialization.Model): - """StorageSpacesPropertiesVmwareStorageProfile. +class ProvisionedClusters(ProxyResource): + """The provisionedClusterInstances resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :ivar properties: All properties of the provisioned cluster. + :vartype properties: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterProperties + :ivar extended_location: Extended Location definition. + :vartype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"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"}, + "properties": {"key": "properties", "type": "ProvisionedClusterProperties"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + } + + def __init__( + self, + *, + properties: Optional["_models.ProvisionedClusterProperties"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: All properties of the provisioned cluster. + :paramtype properties: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterProperties + :keyword extended_location: Extended Location definition. + :paramtype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation + """ + super().__init__(**kwargs) + self.properties = properties + self.extended_location = extended_location + + +class ProvisionedClustersListResult(_serialization.Model): + """A list of provisioned clusters resources. + + :ivar value: + :vartype value: list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[ProvisionedClusters]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ProvisionedClusters"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProvisionedClusterUpgradeProfile(ProxyResource): + """The list of available upgrades for compute pools. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. - :ivar datacenter: Name of the datacenter in VSphere. - :vartype datacenter: str - :ivar datastore: Name of the datastore in VSphere. - :vartype datastore: str - :ivar folder: Name of the folder in VSphere. - :vartype folder: str - :ivar resource_pool: Name of the resource pool in VSphere. - :vartype resource_pool: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". + :vartype provisioning_state: str or + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :vartype control_plane_profile: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile + :ivar agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :vartype agent_pool_profiles: + list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile] """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "control_plane_profile": {"required": True}, + "agent_pool_profiles": {"required": True}, + } + _attribute_map = { - "datacenter": {"key": "datacenter", "type": "str"}, - "datastore": {"key": "datastore", "type": "str"}, - "folder": {"key": "folder", "type": "str"}, - "resource_pool": {"key": "resourcePool", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "control_plane_profile": { + "key": "properties.controlPlaneProfile", + "type": "ProvisionedClusterPoolUpgradeProfile", + }, + "agent_pool_profiles": { + "key": "properties.agentPoolProfiles", + "type": "[ProvisionedClusterPoolUpgradeProfile]", + }, } def __init__( self, *, - datacenter: Optional[str] = None, - datastore: Optional[str] = None, - folder: Optional[str] = None, - resource_pool: Optional[str] = None, + control_plane_profile: "_models.ProvisionedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ProvisionedClusterPoolUpgradeProfile"], **kwargs: Any ) -> None: """ - :keyword datacenter: Name of the datacenter in VSphere. - :paramtype datacenter: str - :keyword datastore: Name of the datastore in VSphere. - :paramtype datastore: str - :keyword folder: Name of the folder in VSphere. - :paramtype folder: str - :keyword resource_pool: Name of the resource pool in VSphere. - :paramtype resource_pool: str + :keyword control_plane_profile: The list of available upgrade versions for the control plane. + Required. + :paramtype control_plane_profile: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile + :keyword agent_pool_profiles: The list of available upgrade versions for agent pools. Required. + :paramtype agent_pool_profiles: + list[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterPoolUpgradeProfile] """ super().__init__(**kwargs) - self.datacenter = datacenter - self.datastore = datastore - self.folder = folder - self.resource_pool = resource_pool + self.provisioning_state = None + self.control_plane_profile = control_plane_profile + self.agent_pool_profiles = agent_pool_profiles class SystemData(_serialization.Model): @@ -4143,51 +2409,106 @@ def __init__( self.last_modified_at = last_modified_at -class VirtualNetworks(TrackedResource): +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class VirtualNetwork(TrackedResource): """The virtualNetworks resource definition. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str :ivar properties: HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork. - :vartype properties: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :vartype properties: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkProperties :ivar extended_location: :vartype extended_location: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksExtendedLocation + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkExtendedLocation """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "VirtualNetworksProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "extended_location": {"key": "extendedLocation", "type": "VirtualNetworksExtendedLocation"}, + "properties": {"key": "properties", "type": "VirtualNetworkProperties"}, + "extended_location": {"key": "extendedLocation", "type": "VirtualNetworkExtendedLocation"}, } def __init__( @@ -4195,8 +2516,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.VirtualNetworksProperties"] = None, - extended_location: Optional["_models.VirtualNetworksExtendedLocation"] = None, + properties: Optional["_models.VirtualNetworkProperties"] = None, + extended_location: Optional["_models.VirtualNetworkExtendedLocation"] = None, **kwargs: Any ) -> None: """ @@ -4205,19 +2526,18 @@ def __init__( :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword properties: HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork. - :paramtype properties: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksProperties + :paramtype properties: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkProperties :keyword extended_location: :paramtype extended_location: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksExtendedLocation + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkExtendedLocation """ super().__init__(tags=tags, location=location, **kwargs) self.properties = properties - self.system_data = None self.extended_location = extended_location -class VirtualNetworksExtendedLocation(_serialization.Model): - """VirtualNetworksExtendedLocation. +class VirtualNetworkExtendedLocation(_serialization.Model): + """VirtualNetworkExtendedLocation. :ivar type: The extended location type. :vartype type: str @@ -4242,68 +2562,20 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** self.name = name -class VirtualNetworksListResult(_serialization.Model): - """VirtualNetworksListResult. - - :ivar value: - :vartype value: list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[VirtualNetworks]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.VirtualNetworks"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VirtualNetworksPatch(_serialization.Model): - """The virtualNetworks resource patch definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class VirtualNetworksProperties(_serialization.Model): +class VirtualNetworkProperties(_serialization.Model): """HybridAKSNetworkSpec defines the desired state of HybridAKSNetwork. Variables are only populated by the server, and will be ignored when sending a request. :ivar infra_vnet_profile: :vartype infra_vnet_profile: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfile + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfile :ivar vip_pool: Virtual IP Pool for Kubernetes. :vartype vip_pool: - list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesVipPoolItem] + list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesVipPoolItem] :ivar vmip_pool: IP Pool for Virtual Machines. :vartype vmip_pool: - list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesVmipPoolItem] + list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesVmipPoolItem] :ivar dhcp_servers: Address of the DHCP servers associated with the network. :vartype dhcp_servers: list[str] :ivar dns_servers: Address of the DNS servers associated with the network. @@ -4313,121 +2585,116 @@ class VirtualNetworksProperties(_serialization.Model): :ivar ip_address_prefix: IP Address Prefix of the network. :vartype ip_address_prefix: str :ivar vlan_id: VLAN Id used by the network. - :vartype vlan_id: str + :vartype vlan_id: int :ivar provisioning_state: Known values are: "Succeeded", "Failed", "Canceled", "InProgress", "Deleting", "Updating", "Accepted", and "Created". :vartype provisioning_state: str or ~azure.mgmt.hybridcontainerservice.models.ProvisioningState :ivar status: HybridAKSNetworkStatus defines the observed state of HybridAKSNetwork. - :vartype status: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesStatus + :vartype status: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesStatus """ _validation = { - "dhcp_servers": {"readonly": True}, - "vlan_id": {"readonly": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, } _attribute_map = { - "infra_vnet_profile": {"key": "infraVnetProfile", "type": "VirtualNetworksPropertiesInfraVnetProfile"}, - "vip_pool": {"key": "vipPool", "type": "[VirtualNetworksPropertiesVipPoolItem]"}, - "vmip_pool": {"key": "vmipPool", "type": "[VirtualNetworksPropertiesVmipPoolItem]"}, + "infra_vnet_profile": {"key": "infraVnetProfile", "type": "VirtualNetworkPropertiesInfraVnetProfile"}, + "vip_pool": {"key": "vipPool", "type": "[VirtualNetworkPropertiesVipPoolItem]"}, + "vmip_pool": {"key": "vmipPool", "type": "[VirtualNetworkPropertiesVmipPoolItem]"}, "dhcp_servers": {"key": "dhcpServers", "type": "[str]"}, "dns_servers": {"key": "dnsServers", "type": "[str]"}, "gateway": {"key": "gateway", "type": "str"}, "ip_address_prefix": {"key": "ipAddressPrefix", "type": "str"}, - "vlan_id": {"key": "vlanID", "type": "str"}, + "vlan_id": {"key": "vlanID", "type": "int"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, - "status": {"key": "status", "type": "VirtualNetworksPropertiesStatus"}, + "status": {"key": "status", "type": "VirtualNetworkPropertiesStatus"}, } def __init__( self, *, - infra_vnet_profile: Optional["_models.VirtualNetworksPropertiesInfraVnetProfile"] = None, - vip_pool: Optional[List["_models.VirtualNetworksPropertiesVipPoolItem"]] = None, - vmip_pool: Optional[List["_models.VirtualNetworksPropertiesVmipPoolItem"]] = None, + infra_vnet_profile: Optional["_models.VirtualNetworkPropertiesInfraVnetProfile"] = None, + vip_pool: Optional[List["_models.VirtualNetworkPropertiesVipPoolItem"]] = None, + vmip_pool: Optional[List["_models.VirtualNetworkPropertiesVmipPoolItem"]] = None, + dhcp_servers: Optional[List[str]] = None, dns_servers: Optional[List[str]] = None, gateway: Optional[str] = None, ip_address_prefix: Optional[str] = None, + vlan_id: Optional[int] = None, **kwargs: Any ) -> None: """ :keyword infra_vnet_profile: :paramtype infra_vnet_profile: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfile + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfile :keyword vip_pool: Virtual IP Pool for Kubernetes. :paramtype vip_pool: - list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesVipPoolItem] + list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesVipPoolItem] :keyword vmip_pool: IP Pool for Virtual Machines. :paramtype vmip_pool: - list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesVmipPoolItem] + list[~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesVmipPoolItem] + :keyword dhcp_servers: Address of the DHCP servers associated with the network. + :paramtype dhcp_servers: list[str] :keyword dns_servers: Address of the DNS servers associated with the network. :paramtype dns_servers: list[str] :keyword gateway: Address of the Gateway associated with the network. :paramtype gateway: str :keyword ip_address_prefix: IP Address Prefix of the network. :paramtype ip_address_prefix: str + :keyword vlan_id: VLAN Id used by the network. + :paramtype vlan_id: int """ super().__init__(**kwargs) self.infra_vnet_profile = infra_vnet_profile self.vip_pool = vip_pool self.vmip_pool = vmip_pool - self.dhcp_servers = None + self.dhcp_servers = dhcp_servers self.dns_servers = dns_servers self.gateway = gateway self.ip_address_prefix = ip_address_prefix - self.vlan_id = None + self.vlan_id = vlan_id self.provisioning_state = None self.status = None -class VirtualNetworksPropertiesInfraVnetProfile(_serialization.Model): - """VirtualNetworksPropertiesInfraVnetProfile. +class VirtualNetworkPropertiesInfraVnetProfile(_serialization.Model): + """VirtualNetworkPropertiesInfraVnetProfile. :ivar hci: Infra network profile for HCI platform. :vartype hci: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileHci - :ivar network_cloud: Infra network profile for the NetworkCloud platform. - :vartype network_cloud: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileNetworkCloud + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfileHci :ivar vmware: Infra network profile for VMware platform. :vartype vmware: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileVmware + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfileVmware """ _attribute_map = { - "hci": {"key": "hci", "type": "VirtualNetworksPropertiesInfraVnetProfileHci"}, - "network_cloud": {"key": "networkCloud", "type": "VirtualNetworksPropertiesInfraVnetProfileNetworkCloud"}, - "vmware": {"key": "vmware", "type": "VirtualNetworksPropertiesInfraVnetProfileVmware"}, + "hci": {"key": "hci", "type": "VirtualNetworkPropertiesInfraVnetProfileHci"}, + "vmware": {"key": "vmware", "type": "VirtualNetworkPropertiesInfraVnetProfileVmware"}, } def __init__( self, *, - hci: Optional["_models.VirtualNetworksPropertiesInfraVnetProfileHci"] = None, - network_cloud: Optional["_models.VirtualNetworksPropertiesInfraVnetProfileNetworkCloud"] = None, - vmware: Optional["_models.VirtualNetworksPropertiesInfraVnetProfileVmware"] = None, + hci: Optional["_models.VirtualNetworkPropertiesInfraVnetProfileHci"] = None, + vmware: Optional["_models.VirtualNetworkPropertiesInfraVnetProfileVmware"] = None, **kwargs: Any ) -> None: """ :keyword hci: Infra network profile for HCI platform. :paramtype hci: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileHci - :keyword network_cloud: Infra network profile for the NetworkCloud platform. - :paramtype network_cloud: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileNetworkCloud + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfileHci :keyword vmware: Infra network profile for VMware platform. :paramtype vmware: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesInfraVnetProfileVmware + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesInfraVnetProfileVmware """ super().__init__(**kwargs) self.hci = hci - self.network_cloud = network_cloud self.vmware = vmware -class VirtualNetworksPropertiesInfraVnetProfileHci(_serialization.Model): +class VirtualNetworkPropertiesInfraVnetProfileHci(_serialization.Model): """Infra network profile for HCI platform. :ivar moc_group: Resource group in MOC(Microsoft On-premises Cloud). @@ -4466,29 +2733,7 @@ def __init__( self.moc_vnet_name = moc_vnet_name -class VirtualNetworksPropertiesInfraVnetProfileNetworkCloud(_serialization.Model): - """Infra network profile for the NetworkCloud platform. - - :ivar network_id: The ARM ID of Network Cloud Network Resource to Associate with this - VirtualNetwork. - :vartype network_id: str - """ - - _attribute_map = { - "network_id": {"key": "networkId", "type": "str"}, - } - - def __init__(self, *, network_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword network_id: The ARM ID of Network Cloud Network Resource to Associate with this - VirtualNetwork. - :paramtype network_id: str - """ - super().__init__(**kwargs) - self.network_id = network_id - - -class VirtualNetworksPropertiesInfraVnetProfileVmware(_serialization.Model): +class VirtualNetworkPropertiesInfraVnetProfileVmware(_serialization.Model): """Infra network profile for VMware platform. :ivar segment_name: Name of the network segment in VSphere. @@ -4508,53 +2753,50 @@ def __init__(self, *, segment_name: Optional[str] = None, **kwargs: Any) -> None self.segment_name = segment_name -class VirtualNetworksPropertiesStatus(_serialization.Model): +class VirtualNetworkPropertiesStatus(_serialization.Model): """HybridAKSNetworkStatus defines the observed state of HybridAKSNetwork. - :ivar provisioning_status: Contains Provisioning errors. - :vartype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesStatusProvisioningStatus + :ivar operation_status: Contains Provisioning errors. + :vartype operation_status: + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesStatusOperationStatus """ _attribute_map = { - "provisioning_status": { - "key": "provisioningStatus", - "type": "VirtualNetworksPropertiesStatusProvisioningStatus", - }, + "operation_status": {"key": "operationStatus", "type": "VirtualNetworkPropertiesStatusOperationStatus"}, } def __init__( self, *, - provisioning_status: Optional["_models.VirtualNetworksPropertiesStatusProvisioningStatus"] = None, + operation_status: Optional["_models.VirtualNetworkPropertiesStatusOperationStatus"] = None, **kwargs: Any ) -> None: """ - :keyword provisioning_status: Contains Provisioning errors. - :paramtype provisioning_status: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesStatusProvisioningStatus + :keyword operation_status: Contains Provisioning errors. + :paramtype operation_status: + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesStatusOperationStatus """ super().__init__(**kwargs) - self.provisioning_status = provisioning_status + self.operation_status = operation_status -class VirtualNetworksPropertiesStatusProvisioningStatus(_serialization.Model): +class VirtualNetworkPropertiesStatusOperationStatus(_serialization.Model): """Contains Provisioning errors. :ivar error: :vartype error: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesStatusProvisioningStatusError + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesStatusOperationStatusError :ivar operation_id: :vartype operation_id: str - :ivar phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. + :ivar phase: Phase represents the current phase of the virtual network provisioning. E.g. + Pending, Running, Terminating, Failed etc. :vartype phase: str :ivar status: :vartype status: str """ _attribute_map = { - "error": {"key": "error", "type": "VirtualNetworksPropertiesStatusProvisioningStatusError"}, + "error": {"key": "error", "type": "VirtualNetworkPropertiesStatusOperationStatusError"}, "operation_id": {"key": "operationId", "type": "str"}, "phase": {"key": "phase", "type": "str"}, "status": {"key": "status", "type": "str"}, @@ -4563,7 +2805,7 @@ class VirtualNetworksPropertiesStatusProvisioningStatus(_serialization.Model): def __init__( self, *, - error: Optional["_models.VirtualNetworksPropertiesStatusProvisioningStatusError"] = None, + error: Optional["_models.VirtualNetworkPropertiesStatusOperationStatusError"] = None, operation_id: Optional[str] = None, phase: Optional[str] = None, status: Optional[str] = None, @@ -4572,11 +2814,11 @@ def __init__( """ :keyword error: :paramtype error: - ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPropertiesStatusProvisioningStatusError + ~azure.mgmt.hybridcontainerservice.models.VirtualNetworkPropertiesStatusOperationStatusError :keyword operation_id: :paramtype operation_id: str - :keyword phase: Phase represents the current phase of cluster actuation. E.g. Pending, Running, - Terminating, Failed etc. + :keyword phase: Phase represents the current phase of the virtual network provisioning. E.g. + Pending, Running, Terminating, Failed etc. :paramtype phase: str :keyword status: :paramtype status: str @@ -4588,8 +2830,8 @@ def __init__( self.status = status -class VirtualNetworksPropertiesStatusProvisioningStatusError(_serialization.Model): - """VirtualNetworksPropertiesStatusProvisioningStatusError. +class VirtualNetworkPropertiesStatusOperationStatusError(_serialization.Model): + """VirtualNetworkPropertiesStatusOperationStatusError. :ivar code: :vartype code: str @@ -4614,8 +2856,8 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message -class VirtualNetworksPropertiesVipPoolItem(_serialization.Model): - """VirtualNetworksPropertiesVipPoolItem. +class VirtualNetworkPropertiesVipPoolItem(_serialization.Model): + """VirtualNetworkPropertiesVipPoolItem. :ivar end_ip: Ending IP address for the IP Pool. :vartype end_ip: str @@ -4640,8 +2882,8 @@ def __init__(self, *, end_ip: Optional[str] = None, start_ip: Optional[str] = No self.start_ip = start_ip -class VirtualNetworksPropertiesVmipPoolItem(_serialization.Model): - """VirtualNetworksPropertiesVmipPoolItem. +class VirtualNetworkPropertiesVmipPoolItem(_serialization.Model): + """VirtualNetworkPropertiesVmipPoolItem. :ivar end_ip: Ending IP address for the IP Pool. :vartype end_ip: str @@ -4666,206 +2908,230 @@ def __init__(self, *, end_ip: Optional[str] = None, start_ip: Optional[str] = No self.start_ip = start_ip -class VMSkuListResult(_serialization.Model): - """The list of supported VM SKUs. +class VirtualNetworksListResult(_serialization.Model): + """VirtualNetworksListResult. + + :ivar value: + :vartype value: list[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[VirtualNetwork]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.VirtualNetwork"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualNetworksPatch(_serialization.Model): + """The virtualNetworks resource patch definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class VmSkuCapabilities(_serialization.Model): + """describes the vm sku capabilities object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar vm_sk_us: Supported VM SKUs. - :vartype vm_sk_us: list[str] - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. + :ivar name: An invariant to describe the feature. :vartype name: str - :ivar type: Resource Type. - :vartype type: str + :ivar value: An invariant if the feature is measured by quantity. + :vartype value: str """ _validation = { - "vm_sk_us": {"readonly": True}, - "id": {"readonly": True}, "name": {"readonly": True}, - "type": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - "vm_sk_us": {"key": "vmSKUs", "type": "[str]"}, - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_sk_us = None - self.id = None self.name = None - self.type = None + self.value = None + +class VmSkuProfile(ProxyResource): + """The list of supported VM SKUs. -class WindowsProfilePassword(_serialization.Model): - """Password for the Windows Profile to be used by the Windows VMs in the cluster. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar admin_password: AdminPassword - Specifies the password of the administrator account. - :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` - **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 - conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper - characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) - :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", - "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - :vartype admin_password: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcontainerservice.models.SystemData + :ivar extended_location: Extended Location definition. + :vartype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation + :ivar properties: + :vartype properties: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfileProperties """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, + } + _attribute_map = { - "admin_password": {"key": "adminPassword", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "properties": {"key": "properties", "type": "VmSkuProfileProperties"}, } - def __init__(self, *, admin_password: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, extended_location: Optional["_models.ExtendedLocation"] = None, **kwargs: Any) -> None: """ - :keyword admin_password: AdminPassword - Specifies the password of the administrator account. - :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` - **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 - conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper - characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) - :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", - "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - :paramtype admin_password: str + :keyword extended_location: Extended Location definition. + :paramtype extended_location: ~azure.mgmt.hybridcontainerservice.models.ExtendedLocation """ super().__init__(**kwargs) - self.admin_password = admin_password - - -class WindowsProfileResponse(_serialization.Model): - """Profile for Windows VMs in the container service cluster. - - :ivar admin_username: AdminUsername - Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. - :vartype admin_username: str - :ivar enable_csi_proxy: EnableCSIProxy - Whether to enable CSI proxy. - :vartype enable_csi_proxy: bool - :ivar license_type: LicenseType - The licenseType to use for Windows VMs. Windows_Server is - used to enable Azure Hybrid User Benefits for Windows VMs. Possible values include: 'None', - 'Windows_Server'. Known values are: "Windows_Server" and "None". - :vartype license_type: str or ~azure.mgmt.hybridcontainerservice.models.LicenseType + self.extended_location = extended_location + self.properties = None + + +class VmSkuProfileList(_serialization.Model): + """A list of VM SKU resources. + + :ivar value: + :vartype value: list[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :ivar next_link: + :vartype next_link: str """ _attribute_map = { - "admin_username": {"key": "adminUsername", "type": "str"}, - "enable_csi_proxy": {"key": "enableCsiProxy", "type": "bool"}, - "license_type": {"key": "licenseType", "type": "str"}, + "value": {"key": "value", "type": "[VmSkuProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - admin_username: Optional[str] = None, - enable_csi_proxy: Optional[bool] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - **kwargs: Any + self, *, value: Optional[List["_models.VmSkuProfile"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword admin_username: AdminUsername - Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. - :paramtype admin_username: str - :keyword enable_csi_proxy: EnableCSIProxy - Whether to enable CSI proxy. - :paramtype enable_csi_proxy: bool - :keyword license_type: LicenseType - The licenseType to use for Windows VMs. Windows_Server is - used to enable Azure Hybrid User Benefits for Windows VMs. Possible values include: 'None', - 'Windows_Server'. Known values are: "Windows_Server" and "None". - :paramtype license_type: str or ~azure.mgmt.hybridcontainerservice.models.LicenseType + :keyword value: + :paramtype value: list[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :keyword next_link: + :paramtype next_link: str """ super().__init__(**kwargs) - self.admin_username = admin_username - self.enable_csi_proxy = enable_csi_proxy - self.license_type = license_type - - -class WindowsProfile(WindowsProfileResponse, WindowsProfilePassword): - """WindowsProfile - Profile for Windows VMs in the container service cluster. - - :ivar admin_password: AdminPassword - Specifies the password of the administrator account. - :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` - **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 - conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper - characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) - :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", - "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - :vartype admin_password: str - :ivar admin_username: AdminUsername - Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. - :vartype admin_username: str - :ivar enable_csi_proxy: EnableCSIProxy - Whether to enable CSI proxy. - :vartype enable_csi_proxy: bool - :ivar license_type: LicenseType - The licenseType to use for Windows VMs. Windows_Server is - used to enable Azure Hybrid User Benefits for Windows VMs. Possible values include: 'None', - 'Windows_Server'. Known values are: "Windows_Server" and "None". - :vartype license_type: str or ~azure.mgmt.hybridcontainerservice.models.LicenseType + self.value = value + self.next_link = next_link + + +class VmSkuProfileProperties(_serialization.Model): + """VmSkuProfileProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", + "Failed", "Canceled", "Creating", "Deleting", "Updating", "Upgrading", "InProgress", + "Accepted", and "Created". + :vartype provisioning_state: str or + ~azure.mgmt.hybridcontainerservice.models.ResourceProvisioningState + :ivar values: Array of HybridAKS Support VM Skus. + :vartype values: list[~azure.mgmt.hybridcontainerservice.models.VmSkuProperties] """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "admin_password": {"key": "adminPassword", "type": "str"}, - "admin_username": {"key": "adminUsername", "type": "str"}, - "enable_csi_proxy": {"key": "enableCsiProxy", "type": "bool"}, - "license_type": {"key": "licenseType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "values": {"key": "values", "type": "[VmSkuProperties]"}, } - def __init__( - self, - *, - admin_password: Optional[str] = None, - admin_username: Optional[str] = None, - enable_csi_proxy: Optional[bool] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, values: Optional[List["_models.VmSkuProperties"]] = None, **kwargs: Any) -> None: """ - :keyword admin_password: AdminPassword - Specifies the password of the administrator account. - :code:`
`:code:`
` **Minimum-length:** 8 characters :code:`
`:code:`
` - **Max-length:** 123 characters :code:`
`:code:`
` **Complexity requirements:** 3 out of 4 - conditions below need to be fulfilled :code:`
` Has lower characters :code:`
`Has upper - characters :code:`
` Has a digit :code:`
` Has a special character (Regex match [\W_]) - :code:`
`:code:`
` **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", - "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - :paramtype admin_password: str - :keyword admin_username: AdminUsername - Specifies the name of the administrator account. - :code:`
`:code:`
` **restriction:** Cannot end in "." :code:`
`:code:`
` - **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", - "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", - "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", - "sys", "test2", "test3", "user4", "user5". :code:`
`:code:`
` **Minimum-length:** 1 - character :code:`
`:code:`
` **Max-length:** 20 characters. - :paramtype admin_username: str - :keyword enable_csi_proxy: EnableCSIProxy - Whether to enable CSI proxy. - :paramtype enable_csi_proxy: bool - :keyword license_type: LicenseType - The licenseType to use for Windows VMs. Windows_Server is - used to enable Azure Hybrid User Benefits for Windows VMs. Possible values include: 'None', - 'Windows_Server'. Known values are: "Windows_Server" and "None". - :paramtype license_type: str or ~azure.mgmt.hybridcontainerservice.models.LicenseType + :keyword values: Array of HybridAKS Support VM Skus. + :paramtype values: list[~azure.mgmt.hybridcontainerservice.models.VmSkuProperties] """ - super().__init__( - admin_username=admin_username, - enable_csi_proxy=enable_csi_proxy, - license_type=license_type, - admin_password=admin_password, - **kwargs - ) - self.admin_password = admin_password - self.admin_username = admin_username - self.enable_csi_proxy = enable_csi_proxy - self.license_type = license_type + super().__init__(**kwargs) + self.provisioning_state = None + self.values = values + + +class VmSkuProperties(_serialization.Model): + """The profile for supported VM skus. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type of the vm. + :vartype resource_type: str + :ivar capabilities: A name value pair to describe the specific vm's capability. + :vartype capabilities: list[~azure.mgmt.hybridcontainerservice.models.VmSkuCapabilities] + :ivar name: The name of the VM Family. + :vartype name: str + :ivar tier: The tier of the VM Family. + :vartype tier: str + :ivar size: The size of the VM Family. + :vartype size: str + """ + + _validation = { + "resource_type": {"readonly": True}, + "capabilities": {"readonly": True}, + "name": {"readonly": True}, + "tier": {"readonly": True}, + "size": {"readonly": True}, + } + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "capabilities": {"key": "capabilities", "type": "[VmSkuCapabilities]"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.resource_type = None + self.capabilities = None + self.name = None + self.tier = None + self.size = None diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/__init__.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/__init__.py index 9441d9851d36..0d9ec775b10d 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/__init__.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/__init__.py @@ -6,12 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._provisioned_clusters_operations import ProvisionedClustersOperations +from ._provisioned_cluster_instances_operations import ProvisionedClusterInstancesOperations from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations from ._agent_pool_operations import AgentPoolOperations -from ._hybrid_container_service_operations import HybridContainerServiceOperations +from ._hybrid_container_service_mgmt_client_operations import HybridContainerServiceMgmtClientOperationsMixin +from ._kubernetes_versions_operations import KubernetesVersionsOperations +from ._vm_skus_operations import VMSkusOperations from ._operations import Operations -from ._storage_spaces_operations import StorageSpacesOperations from ._virtual_networks_operations import VirtualNetworksOperations from ._patch import __all__ as _patch_all @@ -19,12 +20,13 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProvisionedClustersOperations", + "ProvisionedClusterInstancesOperations", "HybridIdentityMetadataOperations", "AgentPoolOperations", - "HybridContainerServiceOperations", + "HybridContainerServiceMgmtClientOperationsMixin", + "KubernetesVersionsOperations", + "VMSkusOperations", "Operations", - "StorageSpacesOperations", "VirtualNetworksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_agent_pool_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_agent_pool_operations.py index 435bfe7b27ee..3fa9821f33a6 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_agent_pool_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_agent_pool_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,39 +37,33 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_get_request(connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", + agent_pool_name, "str", - max_length=63, - min_length=1, + max_length=64, + min_length=3, pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str", max_length=64, min_length=3), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,39 +75,35 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any + connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", + agent_pool_name, "str", - max_length=63, - min_length=1, + max_length=64, + min_length=3, pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str", max_length=64, min_length=3), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,39 +116,33 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_delete_request(connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", + agent_pool_name, "str", - max_length=63, - min_length=1, + max_length=64, + min_length=3, pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str", max_length=64, min_length=3), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,40 +153,34 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( - resource_group_name: str, resource_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_update_request(connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, + "agentPoolName": _SERIALIZER.url( + "agent_pool_name", + agent_pool_name, "str", - max_length=63, - min_length=1, + max_length=64, + min_length=3, pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, "str", max_length=64, min_length=3), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,38 +193,25 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_provisioned_cluster_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_provisioned_cluster_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,18 +242,14 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> _models.AgentPool: - """Gets the agent pool in the provisioned cluster. + def get(self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> _models.AgentPool: + """Gets the agent pool in the provisioned cluster instance. - Gets the agent pool in the Hybrid AKS provisioned cluster. + Gets the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -312,16 +269,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -330,8 +283,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,13 +303,12 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } def _create_or_update_initial( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: Union[_models.AgentPool, IO], **kwargs: Any @@ -371,25 +324,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(agent_pool, (IO, bytes)): + if isinstance(agent_pool, (IOBase, bytes)): _content = agent_pool else: _json = self._serialize.body(agent_pool, "AgentPool") request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -401,8 +350,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,29 +374,26 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @overload def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: _models.AgentPool, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -471,23 +418,20 @@ def begin_create_or_update( @overload def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: IO, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -512,21 +456,18 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: Union[_models.AgentPool, IO], **kwargs: Any ) -> LROPoller[_models.AgentPool]: - """Creates the agent pool in the provisioned cluster. + """Creates the agent pool in the provisioned cluster instance. - Creates the agent pool in the Hybrid AKS provisioned cluster. + Creates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -550,9 +491,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -560,8 +499,7 @@ def begin_create_or_update( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, agent_pool=agent_pool, api_version=api_version, @@ -597,30 +535,136 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, agent_pool_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any ) -> None: - """Deletes the agent pool in the provisioned cluster. + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Deletes the agent pool in the Hybrid AKS provisioned cluster. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + request = build_delete_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + } + + @distributed_trace + def begin_delete(self, connected_cluster_resource_uri: str, agent_pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the agent pool in the provisioned cluster instance. + + Deletes the agent pool in the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" + } + + def _update_initial( + self, + connected_cluster_resource_uri: str, + agent_pool_name: str, + agent_pool: Union[_models.AgentPoolPatch, IO], + **kwargs: Any + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -629,99 +673,120 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(agent_pool, (IOBase, bytes)): + _content = agent_pool + else: + _json = self._serialize.body(agent_pool, "AgentPoolPatch") + + request = build_update_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AgentPool", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + _update_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @overload - def update( + def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, - agent_pool: _models.AgentPool, + agent_pool: _models.AgentPoolPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> LROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str :param agent_pool: Required. - :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPoolPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, agent_pool: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> LROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str @@ -731,122 +796,114 @@ def update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, - resource_group_name: str, - resource_name: str, + connected_cluster_resource_uri: str, agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO], + agent_pool: Union[_models.AgentPoolPatch, IO], **kwargs: Any - ) -> _models.AgentPool: - """Updates the agent pool in the provisioned cluster. + ) -> LROPoller[_models.AgentPool]: + """Updates the agent pool in the provisioned cluster instance. - Updates the agent pool in the Hybrid AKS provisioned cluster. + Updates the agent pool in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param agent_pool_name: Parameter for the name of the agent pool in the provisioned cluster. Required. :type agent_pool_name: str - :param agent_pool: Is either a AgentPool type or a IO type. Required. - :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPool or IO + :param agent_pool: Is either a AgentPoolPatch type or a IO type. Required. + :type agent_pool: ~azure.mgmt.hybridcontainerservice.models.AgentPoolPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPool + :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 AgentPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.AgentPool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + agent_pool_name=agent_pool_name, + agent_pool=agent_pool, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool, (IO, bytes)): - _content = agent_pool - else: - _json = self._serialize.body(agent_pool, "AgentPool") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("AgentPool", pipeline_response) - - if response.status_code == 202: + def get_long_running_output(pipeline_response): deserialized = self._deserialize("AgentPool", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}" + begin_update.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/{agentPoolName}" } @distributed_trace def list_by_provisioned_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> _models.AgentPoolListResult: - """Gets the agent pools in the provisioned cluster. + """Gets the agent pools in the provisioned cluster instance. - Gets the agent pools in the Hybrid AKS provisioned cluster. + Gets the agent pools in the Hybrid AKS provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AgentPoolListResult or the result of cls(response) :rtype: ~azure.mgmt.hybridcontainerservice.models.AgentPoolListResult @@ -863,15 +920,11 @@ def list_by_provisioned_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) request = build_list_by_provisioned_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.list_by_provisioned_cluster.metadata["url"], headers=_headers, @@ -880,8 +933,9 @@ def list_by_provisioned_cluster( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -899,5 +953,5 @@ def list_by_provisioned_cluster( return deserialized list_by_provisioned_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools" } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_mgmt_client_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_mgmt_client_operations.py new file mode 100644 index 000000000000..dff3abdf9118 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_mgmt_client_operations.py @@ -0,0 +1,1004 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_kubernetes_versions_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_put_kubernetes_versions_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_kubernetes_versions_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_vm_skus_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + ) + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_put_vm_skus_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + ) + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_vm_skus_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + ) + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class HybridContainerServiceMgmtClientOperationsMixin(HybridContainerServiceMgmtClientMixinABC): + @distributed_trace + def get_kubernetes_versions( + self, custom_location_resource_uri: str, **kwargs: Any + ) -> _models.KubernetesVersionProfile: + """Gets the supported kubernetes versions. + + Gets the supported kubernetes versions from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KubernetesVersionProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + + request = build_get_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.get_kubernetes_versions.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + def _put_kubernetes_versions_initial( + self, + custom_location_resource_uri: str, + kubernetes_versions: Union[_models.KubernetesVersionProfile, IO], + **kwargs: Any + ) -> _models.KubernetesVersionProfile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(kubernetes_versions, (IOBase, bytes)): + _content = kubernetes_versions + else: + _json = self._serialize.body(kubernetes_versions, "KubernetesVersionProfile") + + request = build_put_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_kubernetes_versions_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _put_kubernetes_versions_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @overload + def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: _models.KubernetesVersionProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Required. + :type kubernetes_versions: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either KubernetesVersionProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Required. + :type kubernetes_versions: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either KubernetesVersionProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_put_kubernetes_versions( + self, + custom_location_resource_uri: str, + kubernetes_versions: Union[_models.KubernetesVersionProfile, IO], + **kwargs: Any + ) -> LROPoller[_models.KubernetesVersionProfile]: + """Puts the kubernetes version. + + Puts the kubernetes version resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param kubernetes_versions: Kubernetes Versions resource definition. Is either a + KubernetesVersionProfile type or a IO type. Required. + :type kubernetes_versions: ~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either KubernetesVersionProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.KubernetesVersionProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._put_kubernetes_versions_initial( + custom_location_resource_uri=custom_location_resource_uri, + kubernetes_versions=kubernetes_versions, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("KubernetesVersionProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + def _delete_kubernetes_versions_initial( # pylint: disable=inconsistent-return-statements + self, custom_location_resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_kubernetes_versions_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self._delete_kubernetes_versions_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_kubernetes_versions_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @distributed_trace + def begin_delete_kubernetes_versions(self, custom_location_resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Delete the kubernetes versions. + + Delete the kubernetes versions resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_kubernetes_versions_initial( # type: ignore + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_kubernetes_versions.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions/default" + } + + @distributed_trace + def get_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> _models.VmSkuProfile: + """Gets the supported VM skus. + + Gets the supported VM skus from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmSkuProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + + request = build_get_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.get_vm_skus.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + def _put_vm_skus_initial( + self, custom_location_resource_uri: str, skus: Union[_models.VmSkuProfile, IO], **kwargs: Any + ) -> _models.VmSkuProfile: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(skus, (IOBase, bytes)): + _content = skus + else: + _json = self._serialize.body(skus, "VmSkuProfile") + + request = build_put_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._put_vm_skus_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _put_vm_skus_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + @overload + def begin_put_vm_skus( + self, + custom_location_resource_uri: str, + skus: _models.VmSkuProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Required. + :type skus: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_put_vm_skus( + self, custom_location_resource_uri: str, skus: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Required. + :type skus: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_put_vm_skus( + self, custom_location_resource_uri: str, skus: Union[_models.VmSkuProfile, IO], **kwargs: Any + ) -> LROPoller[_models.VmSkuProfile]: + """Puts the VM SKUs. + + Puts the VM SKUs resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :param skus: VM SKUs resource definition. Is either a VmSkuProfile type or a IO type. Required. + :type skus: ~azure.mgmt.hybridcontainerservice.models.VmSkuProfile or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VmSkuProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VmSkuProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._put_vm_skus_initial( + custom_location_resource_uri=custom_location_resource_uri, + skus=skus, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VmSkuProfile", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_put_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + def _delete_vm_skus_initial( # pylint: disable=inconsistent-return-statements + self, custom_location_resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_vm_skus_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self._delete_vm_skus_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_vm_skus_initial.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } + + @distributed_trace + def begin_delete_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the Vm Skus. + + Deletes the Vm Sku resource type. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_vm_skus_initial( # type: ignore + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_vm_skus.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus/default" + } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_operations.py deleted file mode 100644 index 6bfcf2d795e0..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_container_service_operations.py +++ /dev/null @@ -1,241 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_orchestrators_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators" - ) # pylint: disable=line-too-long - path_format_arguments = { - "customLocationResourceUri": _SERIALIZER.url( - "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_vm_skus_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus") - path_format_arguments = { - "customLocationResourceUri": _SERIALIZER.url( - "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class HybridContainerServiceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s - :attr:`hybrid_container_service` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_orchestrators( - self, custom_location_resource_uri: str, **kwargs: Any - ) -> _models.OrchestratorVersionProfileListResult: - """Lists the available orchestrators in a custom location. - - Lists the available orchestrators in a custom location for HybridAKS. - - :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of - the custom location resource. Required. - :type custom_location_resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: OrchestratorVersionProfileListResult or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.OrchestratorVersionProfileListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OrchestratorVersionProfileListResult] = kwargs.pop("cls", None) - - request = build_list_orchestrators_request( - custom_location_resource_uri=custom_location_resource_uri, - api_version=api_version, - template_url=self.list_orchestrators.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OrchestratorVersionProfileListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_orchestrators.metadata = { - "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators" - } - - @distributed_trace - def list_vm_skus(self, custom_location_resource_uri: str, **kwargs: Any) -> _models.VMSkuListResult: - """Lists the available VM SKUs in a custom location. - - Lists the available VM SKUs in a custom location for HybridAKS. - - :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of - the custom location resource. Required. - :type custom_location_resource_uri: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VMSkuListResult or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.VMSkuListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VMSkuListResult] = kwargs.pop("cls", None) - - request = build_list_vm_skus_request( - custom_location_resource_uri=custom_location_resource_uri, - api_version=api_version, - template_url=self.list_vm_skus.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMSkuListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_vm_skus.metadata = {"url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus"} diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_identity_metadata_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_identity_metadata_operations.py index 06ed44c45f34..86a58eaf62a1 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_identity_metadata_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_hybrid_identity_metadata_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -21,19 +21,17 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,50 +39,26 @@ _SERIALIZER.client_side_validation = False -def build_put_request( - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_put_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - "hybridIdentityMetadataResourceName": _SERIALIZER.url( - "hybrid_identity_metadata_resource_name", - hybrid_identity_metadata_resource_name, - "str", - max_length=64, - min_length=3, + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,49 +71,25 @@ def build_put_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_get_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - "hybridIdentityMetadataResourceName": _SERIALIZER.url( - "hybrid_identity_metadata_resource_name", - hybrid_identity_metadata_resource_name, - "str", - max_length=64, - min_length=3, + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,49 +100,25 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_delete_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - "hybridIdentityMetadataResourceName": _SERIALIZER.url( - "hybrid_identity_metadata_resource_name", - hybrid_identity_metadata_resource_name, - "str", - max_length=64, - min_length=3, + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,38 +129,25 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_cluster_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_list_by_cluster_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,9 +180,7 @@ def __init__(self, *args, **kwargs): @overload def put( self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, + connected_cluster_resource_uri: str, body: _models.HybridIdentityMetadata, *, content_type: str = "application/json", @@ -280,14 +191,9 @@ def put( Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Required. :type body: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -301,28 +207,16 @@ def put( @overload def put( - self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any + self, connected_cluster_resource_uri: str, body: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.HybridIdentityMetadata: """Creates the hybrid identity metadata resource. Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -336,26 +230,16 @@ def put( @distributed_trace def put( - self, - resource_group_name: str, - resource_name: str, - hybrid_identity_metadata_resource_name: str, - body: Union[_models.HybridIdentityMetadata, IO], - **kwargs: Any + self, connected_cluster_resource_uri: str, body: Union[_models.HybridIdentityMetadata, IO], **kwargs: Any ) -> _models.HybridIdentityMetadata: """Creates the hybrid identity metadata resource. Creates the hybrid identity metadata proxy resource that facilitates the managed identity provisioning. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :param body: Is either a HybridIdentityMetadata type or a IO type. Required. :type body: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -377,25 +261,20 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "HybridIdentityMetadata") request = build_put_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -407,44 +286,42 @@ def put( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **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, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore put.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, hybrid_identity_metadata_resource_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: + def get(self, connected_cluster_resource_uri: str, **kwargs: Any) -> _models.HybridIdentityMetadata: """Get the hybrid identity metadata resource. Get the hybrid identity metadata proxy resource. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HybridIdentityMetadata or the result of cls(response) :rtype: ~azure.mgmt.hybridcontainerservice.models.HybridIdentityMetadata @@ -461,16 +338,11 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -479,8 +351,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -498,30 +371,12 @@ def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, hybrid_identity_metadata_resource_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> None: - """Deletes the hybrid identity metadata resource. - - Deletes the hybrid identity metadata proxy resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param hybrid_identity_metadata_resource_name: Parameter for the name of the hybrid identity - metadata resource. Required. - :type hybrid_identity_metadata_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -533,55 +388,118 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - hybrid_identity_metadata_resource_name=hybrid_identity_metadata_resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}" + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def begin_delete(self, connected_cluster_resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the hybrid identity metadata resource. + + Deletes the hybrid identity metadata proxy resource. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata/default" } @distributed_trace def list_by_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any + self, connected_cluster_resource_uri: str, **kwargs: Any ) -> Iterable["_models.HybridIdentityMetadata"]: - """Lists the hybrid identity metadata resources in a cluster. + """Lists the hybrid identity metadata resources in a provisioned cluster instance. - Lists the hybrid identity metadata proxy resource in a cluster. + Lists the hybrid identity metadata proxy resource in a provisioned cluster instance. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HybridIdentityMetadata or the result of cls(response) @@ -592,9 +510,7 @@ def list_by_cluster( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) error_map = { @@ -609,9 +525,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_by_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, + connected_cluster_resource_uri=connected_cluster_resource_uri, api_version=api_version, template_url=self.list_by_cluster.metadata["url"], headers=_headers, @@ -648,8 +562,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -663,5 +578,5 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list_by_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata" + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/hybridIdentityMetadata" } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_kubernetes_versions_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_kubernetes_versions_operations.py new file mode 100644 index 000000000000..a625a163e7b2 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_kubernetes_versions_operations.py @@ -0,0 +1,174 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions" + ) # pylint: disable=line-too-long + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class KubernetesVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s + :attr:`kubernetes_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, custom_location_resource_uri: str, **kwargs: Any) -> Iterable["_models.KubernetesVersionProfile"]: + """Lists the supported kubernetes versions. + + Lists the supported kubernetes versions from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KubernetesVersionProfile or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.KubernetesVersionProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.KubernetesVersionProfileList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("KubernetesVersionProfileList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/kubernetesVersions" + } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_operations.py index 488f88108a99..f93e79d35977 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,23 +75,19 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """list. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperation or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.ResourceProviderOperation] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -139,7 +128,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -148,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_cluster_instances_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_cluster_instances_operations.py new file mode 100644 index 000000000000..ebd3339d3679 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_cluster_instances_operations.py @@ -0,0 +1,1073 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_upgrade_profile_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_user_kubeconfig_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_admin_kubeconfig_request(connected_cluster_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "connectedClusterResourceUri": _SERIALIZER.url( + "connected_cluster_resource_uri", connected_cluster_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProvisionedClusterInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s + :attr:`provisioned_cluster_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, connected_cluster_resource_uri: str, **kwargs: Any) -> _models.ProvisionedClusters: + """Gets the provisioned cluster instance. + + Gets the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProvisionedClusters or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) + + request = build_get_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + } + + def _create_or_update_initial( + self, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: Union[_models.ProvisionedClusters, IO], + **kwargs: Any + ) -> _models.ProvisionedClusters: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(provisioned_cluster_instance, (IOBase, bytes)): + _content = provisioned_cluster_instance + else: + _json = self._serialize.body(provisioned_cluster_instance, "ProvisionedClusters") + + request = build_create_or_update_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + } + + @overload + def begin_create_or_update( + self, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: _models.ProvisionedClusters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. + + Creates the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Required. + :type provisioned_cluster_instance: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProvisionedClusters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. + + Creates the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Required. + :type provisioned_cluster_instance: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProvisionedClusters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + connected_cluster_resource_uri: str, + provisioned_cluster_instance: Union[_models.ProvisionedClusters, IO], + **kwargs: Any + ) -> LROPoller[_models.ProvisionedClusters]: + """Creates the provisioned cluster instance. + + Creates the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :param provisioned_cluster_instance: Is either a ProvisionedClusters type or a IO type. + Required. + :type provisioned_cluster_instance: + ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ProvisionedClusters or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProvisionedClusters] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + provisioned_cluster_instance=provisioned_cluster_instance, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ProvisionedClusters", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + } + + @distributed_trace + def begin_delete(self, connected_cluster_resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the provisioned cluster instance. + + Deletes the Hybrid AKS provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default" + } + + @distributed_trace + def list(self, connected_cluster_resource_uri: str, **kwargs: Any) -> Iterable["_models.ProvisionedClusters"]: + """Gets the provisioned cluster instances associated with the connected cluster. + + Gets the Hybrid AKS provisioned cluster instances associated with the connected cluster. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProvisionedClusters or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClustersListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProvisionedClustersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances" + } + + @distributed_trace + def get_upgrade_profile( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> _models.ProvisionedClusterUpgradeProfile: + """Gets the upgrade profile of a provisioned cluster instance. + + Gets the upgrade profile of a provisioned cluster instance. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProvisionedClusterUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProvisionedClusterUpgradeProfile] = kwargs.pop("cls", None) + + request = build_get_upgrade_profile_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self.get_upgrade_profile.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProvisionedClusterUpgradeProfile", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/upgradeProfiles/default" + } + + def _list_user_kubeconfig_initial( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> Optional[_models.ListCredentialResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ListCredentialResponse]] = kwargs.pop("cls", None) + + request = build_list_user_kubeconfig_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self._list_user_kubeconfig_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _list_user_kubeconfig_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" + } + + @distributed_trace + def begin_list_user_kubeconfig( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> LROPoller[_models.ListCredentialResponse]: + """Listing the AAD user credentials of a provisioned cluster instance used only in direct mode. + + Lists the AAD user credentials of a provisioned cluster instance used only in direct mode. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ListCredentialResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ListCredentialResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCredentialResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._list_user_kubeconfig_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_user_kubeconfig.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig" + } + + def _list_admin_kubeconfig_initial( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> Optional[_models.ListCredentialResponse]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ListCredentialResponse]] = kwargs.pop("cls", None) + + request = build_list_admin_kubeconfig_request( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + template_url=self._list_admin_kubeconfig_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _list_admin_kubeconfig_initial.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" + } + + @distributed_trace + def begin_list_admin_kubeconfig( + self, connected_cluster_resource_uri: str, **kwargs: Any + ) -> LROPoller[_models.ListCredentialResponse]: + """Listing the admin credentials of a provisioned cluster instance used only in direct mode. + + Lists the admin credentials of a provisioned cluster instance used only in direct mode. + + :param connected_cluster_resource_uri: The fully qualified Azure Resource manager identifier of + the connected cluster resource. Required. + :type connected_cluster_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ListCredentialResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ListCredentialResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCredentialResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._list_admin_kubeconfig_initial( + connected_cluster_resource_uri=connected_cluster_resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ListCredentialResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_list_admin_kubeconfig.metadata = { + "url": "/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listAdminKubeconfig" + } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_clusters_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_clusters_operations.py deleted file mode 100644 index 50b831425b07..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_provisioned_clusters_operations.py +++ /dev/null @@ -1,1360 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_upgrade_profile_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeProfiles/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_upgrade_node_image_version_for_entire_cluster_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceName": _SERIALIZER.url( - "resource_name", - resource_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProvisionedClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s - :attr:`provisioned_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ProvisionedClustersResponse: - """Gets the provisioned cluster. - - Gets the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProvisionedClustersResponse or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClusters, IO], - **kwargs: Any - ) -> _models.ProvisionedClustersResponse: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(provisioned_clusters, (IO, bytes)): - _content = provisioned_clusters - else: - _json = self._serialize.body(provisioned_clusters, "ProvisionedClusters") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: _models.ProvisionedClusters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. - - Creates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. - - Creates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClusters, IO], - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Creates the provisioned cluster. - - Creates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Is either a ProvisionedClusters type or a IO type. Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - provisioned_clusters=provisioned_clusters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes the provisioned cluster. - - Deletes the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - def _update_initial( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClustersPatch, IO], - **kwargs: Any - ) -> _models.ProvisionedClustersResponse: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(provisioned_clusters, (IO, bytes)): - _content = provisioned_clusters - else: - _json = self._serialize.body(provisioned_clusters, "ProvisionedClustersPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: _models.ProvisionedClustersPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. - - Updates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. - - Updates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Required. - :type provisioned_clusters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - resource_name: str, - provisioned_clusters: Union[_models.ProvisionedClustersPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.ProvisionedClustersResponse]: - """Updates the provisioned cluster. - - Updates the Hybrid AKS provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :param provisioned_clusters: Is either a ProvisionedClustersPatch type or a IO type. Required. - :type provisioned_clusters: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersPatch - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ProvisionedClustersResponse or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProvisionedClustersResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - provisioned_clusters=provisioned_clusters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponse", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ProvisionedClustersResponse"]: - """Gets the provisioned clusters in a resource group. - - Gets the Hybrid AKS provisioned cluster in a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProvisionedClustersResponse or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponseListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponseListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ProvisionedClustersResponse"]: - """Gets the provisioned clusters in a subscription. - - Gets the Hybrid AKS provisioned cluster in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProvisionedClustersResponse or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.ProvisionedClustersResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClustersResponseListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ProvisionedClustersResponseListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters" - } - - @distributed_trace - def get_upgrade_profile( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ProvisionedClusterUpgradeProfile: - """Gets the upgrade profile of a provisioned cluster. - - Gets the upgrade profile of a provisioned cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProvisionedClusterUpgradeProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.ProvisionedClusterUpgradeProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ProvisionedClusterUpgradeProfile] = kwargs.pop("cls", None) - - request = build_get_upgrade_profile_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_upgrade_profile.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProvisionedClusterUpgradeProfile", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_upgrade_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeProfiles/default" - } - - def _upgrade_node_image_version_for_entire_cluster_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_upgrade_node_image_version_for_entire_cluster_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._upgrade_node_image_version_for_entire_cluster_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _upgrade_node_image_version_for_entire_cluster_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster" - } - - @distributed_trace - def begin_upgrade_node_image_version_for_entire_cluster( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Upgrades the node image version of the cluster control plane and all agent pools to the latest. - - Upgrading the node image version of a cluster applies the newest OS and runtime updates to the - nodes. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: Parameter for the name of the provisioned cluster. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._upgrade_node_image_version_for_entire_cluster_initial( # type: ignore - resource_group_name=resource_group_name, - resource_name=resource_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_upgrade_node_image_version_for_entire_cluster.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeNodeImageVersionForEntireCluster" - } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_storage_spaces_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_storage_spaces_operations.py deleted file mode 100644 index bf393ad9eb04..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_storage_spaces_operations.py +++ /dev/null @@ -1,1055 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_retrieve_request( - resource_group_name: str, storage_spaces_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSpacesName": _SERIALIZER.url( - "storage_spaces_name", storage_spaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, storage_spaces_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSpacesName": _SERIALIZER.url( - "storage_spaces_name", storage_spaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, storage_spaces_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSpacesName": _SERIALIZER.url( - "storage_spaces_name", storage_spaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, storage_spaces_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "storageSpacesName": _SERIALIZER.url( - "storage_spaces_name", storage_spaces_name, "str", max_length=64, min_length=3 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class StorageSpacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s - :attr:`storage_spaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def retrieve(self, resource_group_name: str, storage_spaces_name: str, **kwargs: Any) -> _models.StorageSpaces: - """Gets the storage space object. - - Gets the Hybrid AKS storage space object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageSpaces or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - request = build_retrieve_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.retrieve.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpaces, IO], - **kwargs: Any - ) -> _models.StorageSpaces: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_spaces, (IO, bytes)): - _content = storage_spaces - else: - _json = self._serialize.body(storage_spaces, "StorageSpaces") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: _models.StorageSpaces, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpaces, IO], - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Puts the storage object. - - Puts the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Is either a StorageSpaces type or a IO type. Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpaces or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - storage_spaces=storage_spaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSpaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, storage_spaces_name: str, **kwargs: Any - ) -> None: - """Deletes the storage object. - - Deletes the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - def _update_initial( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpacesPatch, IO], - **kwargs: Any - ) -> _models.StorageSpaces: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_spaces, (IO, bytes)): - _content = storage_spaces - else: - _json = self._serialize.body(storage_spaces, "StorageSpacesPatch") - - request = build_update_request( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("StorageSpaces", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: _models.StorageSpacesPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Required. - :type storage_spaces: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - storage_spaces_name: str, - storage_spaces: Union[_models.StorageSpacesPatch, IO], - **kwargs: Any - ) -> LROPoller[_models.StorageSpaces]: - """Patches the storage object. - - Patches the Hybrid AKS storage object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param storage_spaces_name: Parameter for the name of the storage object. Required. - :type storage_spaces_name: str - :param storage_spaces: Is either a StorageSpacesPatch type or a IO type. Required. - :type storage_spaces: ~azure.mgmt.hybridcontainerservice.models.StorageSpacesPatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageSpaces or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageSpaces] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - storage_spaces_name=storage_spaces_name, - storage_spaces=storage_spaces, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageSpaces", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.StorageSpaces"]: - """List the storage object by resource group. - - List the Hybrid AKS storage object by resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSpaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpacesListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSpacesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.StorageSpaces"]: - """List the storage object by subscription. - - List the Hybrid AKS storage object by subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageSpaces or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.StorageSpaces] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.StorageSpacesListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StorageSpacesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - 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, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces" - } diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_virtual_networks_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_virtual_networks_operations.py index 6b22464ee5ff..bd39e65eab1d 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_virtual_networks_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,32 +40,35 @@ def build_retrieve_request( - resource_group_name: str, virtual_networks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualNetworksName": _SERIALIZER.url( - "virtual_networks_name", virtual_networks_name, "str", max_length=64, min_length=3 + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,33 +80,36 @@ def build_retrieve_request( def build_create_or_update_request( - resource_group_name: str, virtual_networks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualNetworksName": _SERIALIZER.url( - "virtual_networks_name", virtual_networks_name, "str", max_length=64, min_length=3 + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,32 +123,35 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, virtual_networks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualNetworksName": _SERIALIZER.url( - "virtual_networks_name", virtual_networks_name, "str", max_length=64, min_length=3 + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,33 +163,36 @@ def build_delete_request( def build_update_request( - resource_group_name: str, virtual_networks_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, virtual_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "virtualNetworksName": _SERIALIZER.url( - "virtual_networks_name", virtual_networks_name, "str", max_length=64, min_length=3 + "virtualNetworkName": _SERIALIZER.url( + "virtual_network_name", + virtual_network_name, + "str", + max_length=64, + min_length=3, + pattern=r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$", ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,9 +209,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,13 +218,13 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,9 +239,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,10 +247,10 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,7 +281,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwargs: Any) -> _models.VirtualNetworks: + def retrieve(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any) -> _models.VirtualNetwork: """Gets the virtual network. Gets the Hybrid AKS virtual network. @@ -285,11 +289,11 @@ def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwarg :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualNetworks or the result of cls(response) - :rtype: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks + :return: VirtualNetwork or the result of cls(response) + :rtype: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -303,14 +307,12 @@ def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_retrieve_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.retrieve.metadata["url"], @@ -320,8 +322,9 @@ def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwarg request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -331,7 +334,7 @@ def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -339,16 +342,16 @@ def retrieve(self, resource_group_name: str, virtual_networks_name: str, **kwarg return deserialized retrieve.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } def _create_or_update_initial( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: Union[_models.VirtualNetworks, IO], + virtual_network_name: str, + virtual_networks: Union[_models.VirtualNetwork, IO], **kwargs: Any - ) -> _models.VirtualNetworks: + ) -> _models.VirtualNetwork: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -360,23 +363,21 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_networks, (IO, bytes)): + if isinstance(virtual_networks, (IOBase, bytes)): _content = virtual_networks else: - _json = self._serialize.body(virtual_networks, "VirtualNetworks") + _json = self._serialize.body(virtual_networks, "VirtualNetwork") request = build_create_or_update_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -389,8 +390,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,10 +403,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -412,19 +414,19 @@ def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @overload def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: _models.VirtualNetworks, + virtual_network_name: str, + virtual_networks: _models.VirtualNetwork, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -432,10 +434,10 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. - :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks + :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -447,10 +449,9 @@ def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -458,12 +459,12 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -471,8 +472,8 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -486,10 +487,9 @@ def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -497,10 +497,10 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - virtual_networks_name: str, - virtual_networks: Union[_models.VirtualNetworks, IO], + virtual_network_name: str, + virtual_networks: Union[_models.VirtualNetwork, IO], **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Puts the virtual network. Puts the Hybrid AKS virtual network. @@ -508,10 +508,10 @@ def begin_create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str - :param virtual_networks: Is either a VirtualNetworks type or a IO type. Required. - :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworks or IO + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str + :param virtual_networks: Is either a VirtualNetwork type or a IO type. Required. + :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -523,27 +523,24 @@ def begin_create_or_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, virtual_networks=virtual_networks, api_version=api_version, content_type=content_type, @@ -555,7 +552,7 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -578,27 +575,12 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_networks_name: str, **kwargs: Any + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, virtual_network_name: str, **kwargs: Any ) -> None: - """Deletes the virtual network. - - Deletes the Hybrid AKS virtual network. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,48 +592,119 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the virtual network. + + Deletes the Hybrid AKS virtual network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + virtual_network_name=virtual_network_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } def _update_initial( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: Union[_models.VirtualNetworksPatch, IO], **kwargs: Any - ) -> _models.VirtualNetworks: + ) -> Optional[_models.VirtualNetwork]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -663,23 +716,21 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualNetwork]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(virtual_networks, (IO, bytes)): + if isinstance(virtual_networks, (IOBase, bytes)): _content = virtual_networks else: _json = self._serialize.body(virtual_networks, "VirtualNetworksPatch") request = build_update_request( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -692,8 +743,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -703,31 +755,33 @@ def _update_initial( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @overload def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: _models.VirtualNetworksPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -735,8 +789,8 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -750,10 +804,9 @@ def begin_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -761,12 +814,12 @@ def begin_update( def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -774,8 +827,8 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Required. :type virtual_networks: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -789,10 +842,9 @@ def begin_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -800,10 +852,10 @@ def begin_update( def begin_update( self, resource_group_name: str, - virtual_networks_name: str, + virtual_network_name: str, virtual_networks: Union[_models.VirtualNetworksPatch, IO], **kwargs: Any - ) -> LROPoller[_models.VirtualNetworks]: + ) -> LROPoller[_models.VirtualNetwork]: """Patches the virtual network. Patches the Hybrid AKS virtual network. @@ -811,8 +863,8 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param virtual_networks_name: Parameter for the name of the virtual network. Required. - :type virtual_networks_name: str + :param virtual_network_name: Parameter for the name of the virtual network. Required. + :type virtual_network_name: str :param virtual_networks: Is either a VirtualNetworksPatch type or a IO type. Required. :type virtual_networks: ~azure.mgmt.hybridcontainerservice.models.VirtualNetworksPatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -826,27 +878,24 @@ def begin_update( :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 VirtualNetworks or the result of + :return: An instance of LROPoller that returns either VirtualNetwork or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworks] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - virtual_networks_name=virtual_networks_name, + virtual_network_name=virtual_network_name, virtual_networks=virtual_networks, api_version=api_version, content_type=content_type, @@ -858,7 +907,7 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualNetworks", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -881,11 +930,11 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}" + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}" } @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetworks"]: + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: """List virtual networks by resource group. Lists the Hybrid AKS virtual networks by resource group. @@ -894,16 +943,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksListResult] = kwargs.pop("cls", None) error_map = { @@ -956,8 +1003,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -975,22 +1023,20 @@ def get_next(next_link=None): } @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetworks"]: + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: """List virtual networks by subscription. Lists the Hybrid AKS virtual networks by subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualNetworks or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetworks] + :return: An iterator like instance of either VirtualNetwork or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.VirtualNetwork] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksListResult] = kwargs.pop("cls", None) error_map = { @@ -1042,8 +1088,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_vm_skus_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_vm_skus_operations.py new file mode 100644 index 000000000000..ef0b0b4e45ab --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/azure/mgmt/hybridcontainerservice/operations/_vm_skus_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import HybridContainerServiceMgmtClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(custom_location_resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus") + path_format_arguments = { + "customLocationResourceUri": _SERIALIZER.url( + "custom_location_resource_uri", custom_location_resource_uri, "str", skip_quote=True + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VMSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcontainerservice.HybridContainerServiceMgmtClient`'s + :attr:`vm_skus` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, custom_location_resource_uri: str, **kwargs: Any) -> Iterable["_models.VmSkuProfile"]: + """Lists the supported VM SKUs. + + Lists the supported VM SKUs from the underlying custom location. + + :param custom_location_resource_uri: The fully qualified Azure Resource manager identifier of + the custom location resource. Required. + :type custom_location_resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmSkuProfile or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcontainerservice.models.VmSkuProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmSkuProfileList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + custom_location_resource_uri=custom_location_resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VmSkuProfileList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{customLocationResourceUri}/providers/Microsoft.HybridContainerService/skus"} diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/create_hybrid_identity_metadata.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/create_hybrid_identity_metadata.py index bc16776a8993..472f70459ca8 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/create_hybrid_identity_metadata.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/create_hybrid_identity_metadata.py @@ -26,13 +26,11 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_identity_metadata.put( - resource_group_name="testrg", - resource_name="ContosoTargetCluster", - hybrid_identity_metadata_resource_name="default", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", body={ "properties": { "publicKey": "8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2", @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/CreateHybridIdentityMetadata.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/CreateHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_agent_pool.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_agent_pool.py index 301b15e126eb..b44b6a9a98ec 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_agent_pool.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_agent_pool.py @@ -26,17 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.agent_pool.delete( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + client.agent_pool.begin_delete( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", agent_pool_name="test-hybridaksnodepool", - ) - print(response) + ).result() -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteAgentPool.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteAgentPool.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_hybrid_identity_metadata.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_hybrid_identity_metadata.py index 9abc66e0f3f3..7ef172343e01 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_hybrid_identity_metadata.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_hybrid_identity_metadata.py @@ -26,17 +26,14 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_identity_metadata.delete( - resource_group_name="testrg", - resource_name="ContosoTargetCluster", - hybrid_identity_metadata_resource_name="default", - ) - print(response) + client.hybrid_identity_metadata.begin_delete( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", + ).result() -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteHybridIdentityMetadata.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_storage_space.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_kubernetes_versions.py similarity index 75% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_storage_space.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_kubernetes_versions.py index 6e1978372da3..ad55ed8e7110 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_storage_space.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_kubernetes_versions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python update_storage_space.py + python delete_kubernetes_versions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,14 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.storage_spaces.begin_update( - resource_group_name="test-arcappliance-resgrp", - storage_spaces_name="test-storage", - storage_spaces={"tags": {"additionalProperties": "sample"}}, + client.begin_delete_kubernetes_versions( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", ).result() - print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateStorageSpace.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteKubernetesVersions.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster.py deleted file mode 100644 index c8aa223f2757..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridcontainerservice -# USAGE - python delete_provisioned_cluster.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridContainerServiceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", - ) - - response = client.provisioned_clusters.delete( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", - ) - print(response) - - -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteProvisionedCluster.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_provisioned_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster_instance.py similarity index 74% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_provisioned_cluster.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster_instance.py index 704d47f64db4..ccaac68c13ec 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_provisioned_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_provisioned_cluster_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python update_provisioned_cluster.py + python delete_provisioned_cluster_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +26,14 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.provisioned_clusters.begin_update( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", - provisioned_clusters={"tags": {"additionalProperties": "sample"}}, + client.provisioned_cluster_instances.begin_delete( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ).result() - print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateProvisionedCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteProvisionedClusterInstance.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_virtual_network.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_virtual_network.py index fbd03bcb5cdc..d7d19b4f9347 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_virtual_network.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_virtual_network.py @@ -29,13 +29,12 @@ def main(): subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", ) - response = client.virtual_networks.delete( + client.virtual_networks.begin_delete( resource_group_name="test-arcappliance-resgrp", - virtual_networks_name="test-vnet-static", - ) - print(response) + virtual_network_name="test-vnet-static", + ).result() -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_vm_skus.py similarity index 75% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_vm_skus.py index a7d2065c0d75..b672c7fbf22b 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_vm_skus.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python get_provisioned_cluster.py + python delete_vm_skus.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,14 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.provisioned_clusters.get( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", - ) - print(response) + client.begin_delete_vm_skus( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + ).result() -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetProvisionedCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/DeleteVmSkus.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_agent_pool.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_agent_pool.py index f3662d9ea61a..ac050ff7fc41 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_agent_pool.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_agent_pool.py @@ -26,17 +26,16 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pool.get( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", agent_pool_name="test-hybridaksnodepool", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetAgentPool.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetAgentPool.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_hybrid_identity_metadata.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_hybrid_identity_metadata.py index 2548593a61d6..c1d3d564b4ad 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_hybrid_identity_metadata.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_hybrid_identity_metadata.py @@ -26,17 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_identity_metadata.get( - resource_group_name="testrg", - resource_name="ContosoTargetCluster", - hybrid_identity_metadata_resource_name="default", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetHybridIdentityMetadata.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_orchestrators.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_kubernetes_versions.py similarity index 89% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_orchestrators.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_kubernetes_versions.py index cb39b01b2788..193c23b9718c 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_orchestrators.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_kubernetes_versions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python list_orchestrators.py + python get_kubernetes_versions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -29,12 +29,12 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_container_service.list_orchestrators( + response = client.get_kubernetes_versions( custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListOrchestrators.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetKubernetesVersions.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_storage_space.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster_instance.py similarity index 75% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_storage_space.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster_instance.py index 8eeb6a4a208d..249bec93e3f0 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_storage_space.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_provisioned_cluster_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python get_storage_space.py + python get_provisioned_cluster_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.storage_spaces.retrieve( - resource_group_name="test-arcappliance-resgrp", - storage_spaces_name="test-storage", + response = client.provisioned_cluster_instances.get( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetStorageSpace.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetProvisionedClusterInstance.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_virtual_network.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_virtual_network.py index ff702b1bee05..29b7b31722f4 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_virtual_network.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_virtual_network.py @@ -31,11 +31,11 @@ def main(): response = client.virtual_networks.retrieve( resource_group_name="test-arcappliance-resgrp", - virtual_networks_name="test-vnet-static", + virtual_network_name="test-vnet-static", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/GetVirtualNetwork.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_storage_space.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_vm_skus.py similarity index 77% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_storage_space.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_vm_skus.py index 4ff6483dd0db..100681ccdfaa 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/delete_storage_space.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/get_vm_skus.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python delete_storage_space.py + python get_vm_skus.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.storage_spaces.delete( - resource_group_name="test-arcappliance-resgrp", - storage_spaces_name="test-storage", + response = client.get_vm_skus( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/DeleteStorageSpace.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/GetVmSkus.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/hybrid_identity_metadata_list_by_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/hybrid_identity_metadata_list_by_cluster.py index 0de8422e2b74..083b494d1ff1 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/hybrid_identity_metadata_list_by_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/hybrid_identity_metadata_list_by_cluster.py @@ -26,17 +26,16 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) response = client.hybrid_identity_metadata.list_by_cluster( - resource_group_name="testrg", - resource_name="ContosoTargetCluster", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ) for item in response: print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/HybridIdentityMetadataListByCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/HybridIdentityMetadataListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster_instance.py similarity index 77% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster_instance.py index 811b3f18fc45..7863450c7ca9 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_agent_pool_by_provisioned_cluster_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python list_agent_pool_by_provisioned_cluster.py + python list_agent_pool_by_provisioned_cluster_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pool.list_by_provisioned_cluster( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ) print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListAgentPoolByProvisionedCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListAgentPoolByProvisionedClusterInstance.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_resource_group.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_kubernetes_versions.py similarity index 75% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_resource_group.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_kubernetes_versions.py index b0adb4a8fb27..4229d6af8fe2 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_resource_group.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_kubernetes_versions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python list_provisioned_cluster_by_resource_group.py + python list_kubernetes_versions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,16 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.provisioned_clusters.list_by_resource_group( - resource_group_name="test-arcappliance-resgrp", + response = client.kubernetes_versions.list( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", ) for item in response: print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListProvisionedClusterByResourceGroup.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListKubernetesVersions.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_operations.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_operations.py index fa7305e40a81..f5c03b098f3f 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_operations.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListOperations.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_subscription.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_subscription.py deleted file mode 100644 index 979c65a7d2b6..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridcontainerservice -# USAGE - python list_provisioned_cluster_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridContainerServiceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", - ) - - response = client.provisioned_clusters.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListProvisionedClusterBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_resource_group.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_instances.py similarity index 75% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_resource_group.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_instances.py index 9d68f6c0afbc..c77da87f9735 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_resource_group.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_provisioned_cluster_instances.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python list_storage_space_by_resource_group.py + python list_provisioned_cluster_instances.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,16 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.storage_spaces.list_by_resource_group( - resource_group_name="test-arcappliance-resgrp", + response = client.provisioned_cluster_instances.list( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ) for item in response: print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListStorageSpaceByResourceGroup.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListProvisionedClusterInstances.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_subscription.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_subscription.py deleted file mode 100644 index 0db7313470a0..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_storage_space_by_subscription.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridcontainerservice -# USAGE - python list_storage_space_by_subscription.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridContainerServiceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", - ) - - response = client.storage_spaces.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListStorageSpaceBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_resource_group.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_resource_group.py index 974e021b00db..431c8959240f 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_resource_group.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVirtualNetworkByResourceGroup.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListVirtualNetworkByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_subscription.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_subscription.py index 69cc902ef7e8..bd6fafe86104 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_subscription.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_virtual_network_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVirtualNetworkBySubscription.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListVirtualNetworkBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_vm_skus.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_vm_skus.py index fdc6c8a97a8d..164e3d66e792 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_vm_skus.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/list_vm_skus.py @@ -29,12 +29,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_container_service.list_vm_skus( + response = client.vm_skus.list( custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ListVMSkus.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ListVmSkus.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_get_upgrade_profile.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_get_upgrade_profile.py new file mode 100644 index 000000000000..cd652266883a --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_get_upgrade_profile.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcontainerservice +# USAGE + python provisioned_cluster_instance_get_upgrade_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridContainerServiceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.provisioned_cluster_instances.get_upgrade_profile( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", + ) + print(response) + + +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ProvisionedClusterInstanceGetUpgradeProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_admin_kubeconfig.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_admin_kubeconfig.py new file mode 100644 index 000000000000..4f23cb041de8 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_admin_kubeconfig.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcontainerservice +# USAGE + python provisioned_cluster_instance_list_admin_kubeconfig.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridContainerServiceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.provisioned_cluster_instances.begin_list_admin_kubeconfig( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", + ).result() + print(response) + + +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ProvisionedClusterInstanceListAdminKubeconfig.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_upgrade_node_image_version_for_entire_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_user_kubeconfig.py similarity index 72% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_upgrade_node_image_version_for_entire_cluster.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_user_kubeconfig.py index 098c4d8d697a..2de80c397ace 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_upgrade_node_image_version_for_entire_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_cluster_instance_list_user_kubeconfig.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python provisioned_clusters_upgrade_node_image_version_for_entire_cluster.py + python provisioned_cluster_instance_list_user_kubeconfig.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +26,15 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.provisioned_clusters.begin_upgrade_node_image_version_for_entire_cluster( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + response = client.provisioned_cluster_instances.begin_list_user_kubeconfig( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ProvisionedClustersUpgradeNodeImageVersionForEntireCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/ProvisionedClusterInstanceListUserKubeconfig.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_get_upgrade_profile.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_get_upgrade_profile.py deleted file mode 100644 index 1aedbf093397..000000000000 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/provisioned_clusters_get_upgrade_profile.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-hybridcontainerservice -# USAGE - python provisioned_clusters_get_upgrade_profile.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = HybridContainerServiceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", - ) - - response = client.provisioned_clusters.get_upgrade_profile( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", - ) - print(response) - - -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/ProvisionedClustersGetUpgradeProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_agent_pool.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_agent_pool.py index 261141a9b82f..97df39e1e390 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_agent_pool.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_agent_pool.py @@ -26,18 +26,17 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) response = client.agent_pool.begin_create_or_update( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", agent_pool_name="test-hybridaksnodepool", agent_pool={"location": "westus", "properties": {"count": 1, "osType": "Linux", "vmSize": "Standard_A4_v2"}}, ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutAgentPool.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/PutAgentPool.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_storage_space.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_kubernetes_versions.py similarity index 70% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_storage_space.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_kubernetes_versions.py index ea6f73df295b..820d1ded21a4 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_storage_space.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_kubernetes_versions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python put_storage_space.py + python put_kubernetes_versions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,30 +26,21 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.storage_spaces.begin_create_or_update( - resource_group_name="test-arcappliance-resgrp", - storage_spaces_name="test-storage", - storage_spaces={ + response = client.begin_put_kubernetes_versions( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + kubernetes_versions={ "extendedLocation": { "name": "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation", "type": "CustomLocation", - }, - "location": "westus", - "properties": { - "hciStorageProfile": { - "mocGroup": "target-group", - "mocLocation": "MocLocation", - "mocStorageContainer": "WssdStorageContainer", - } - }, + } }, ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutStorageSpace.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/PutKubernetesVersions.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster_instance.py similarity index 64% rename from sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster.py rename to sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster_instance.py index 16a9f2e57e48..cc7d81ccaa0d 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_provisioned_cluster_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-hybridcontainerservice # USAGE - python put_provisioned_cluster.py + python put_provisioned_cluster_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,18 +26,16 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.provisioned_clusters.begin_create_or_update( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", - provisioned_clusters={ + response = client.provisioned_cluster_instances.begin_create_or_update( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", + provisioned_cluster_instance={ "extendedLocation": { "name": "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation", "type": "CustomLocation", }, - "location": "westus", "properties": { "agentPoolProfiles": [ {"count": 1, "name": "default-nodepool-1", "osType": "Linux", "vmSize": "Standard_A4_v2"} @@ -45,14 +43,9 @@ def main(): "cloudProviderProfile": { "infraNetworkProfile": { "vnetSubnetIds": [ - "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/virtualNetworks/test-vnet-static" + "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.AzureStackHCI/logicalNetworks/test-vnet-static" ] - }, - "infraStorageProfile": { - "storageSpaceIds": [ - "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.HybridContainerService/storageSpaces/test-storage" - ] - }, + } }, "controlPlane": { "count": 1, @@ -63,28 +56,17 @@ def main(): "vmSize": "Standard_A4_v2", }, "kubernetesVersion": "v1.20.5", + "licenseProfile": {"azureHybridBenefit": "NotApplicable"}, "linuxProfile": { "ssh": {"publicKeys": [{"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCY......."}]} }, - "networkProfile": { - "loadBalancerProfile": { - "count": 1, - "linuxProfile": { - "ssh": {"publicKeys": [{"keyData": "ssh-rsa AAAAB2NzaC1yc2EAAAADAQABAAACAQCY......"}]} - }, - "osType": "Linux", - "vmSize": "Standard_K8S3_v1", - }, - "loadBalancerSku": "unstacked-haproxy", - "networkPolicy": "calico", - "podCidr": "10.244.0.0/16", - }, + "networkProfile": {"networkPolicy": "calico", "podCidr": "10.244.0.0/16"}, }, }, ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutProvisionedCluster.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/PutProvisionedClusterInstance.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_virtual_network.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_virtual_network.py index 6be93b119c4a..9ec15353a866 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_virtual_network.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_virtual_network.py @@ -31,7 +31,7 @@ def main(): response = client.virtual_networks.begin_create_or_update( resource_group_name="test-arcappliance-resgrp", - virtual_networks_name="test-vnet-static", + virtual_network_name="test-vnet-static", virtual_networks={ "extendedLocation": { "name": "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation", @@ -39,10 +39,12 @@ def main(): }, "location": "westus", "properties": { - "infraVnetProfile": { - "hci": {"mocGroup": "target-group", "mocLocation": "MocLocation", "mocVnetName": "test-vnet"} - }, + "dnsServers": ["192.168.0.1"], + "gateway": "192.168.0.1", + "infraVnetProfile": {"vmware": {"segmentName": "test-network"}}, + "ipAddressPrefix": "192.168.0.0/16", "vipPool": [{"endIP": "192.168.0.50", "startIP": "192.168.0.10"}], + "vlanID": 10, "vmipPool": [{"endIP": "192.168.0.130", "startIP": "192.168.0.110"}], }, }, @@ -50,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/PutVirtualNetwork.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/PutVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_vm_skus.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_vm_skus.py new file mode 100644 index 000000000000..f20ea192bfe4 --- /dev/null +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/put_vm_skus.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcontainerservice +# USAGE + python put_vm_skus.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = HybridContainerServiceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.begin_put_vm_skus( + custom_location_resource_uri="subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourceGroups/test-arcappliance-resgrp/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + skus={ + "extendedLocation": { + "name": "/subscriptions/a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b/resourcegroups/test-arcappliance-resgrp/providers/microsoft.extendedlocation/customlocations/testcustomlocation", + "type": "CustomLocation", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/PutVmSkus.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_agent_pool.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_agent_pool.py index f9130ffab621..522f956b9e0b 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_agent_pool.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_agent_pool.py @@ -26,18 +26,17 @@ def main(): client = HybridContainerServiceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="a3e42606-29b1-4d7d-b1d9-9ff6b9d3c71b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.agent_pool.update( - resource_group_name="test-arcappliance-resgrp", - resource_name="test-hybridakscluster", + response = client.agent_pool.begin_update( + connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", agent_pool_name="test-hybridaksnodepool", - agent_pool={"location": "westus", "properties": {"count": 3}}, - ) + agent_pool={"tags": {"additionalProperties": "sample"}}, + ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateAgentPool.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/UpdateAgentPool.json if __name__ == "__main__": main() diff --git a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_virtual_network.py b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_virtual_network.py index 1e2f03fe7c12..82785c0d35a9 100644 --- a/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_virtual_network.py +++ b/sdk/hybridcontainerservice/azure-mgmt-hybridcontainerservice/generated_samples/update_virtual_network.py @@ -31,12 +31,12 @@ def main(): response = client.virtual_networks.begin_update( resource_group_name="test-arcappliance-resgrp", - virtual_networks_name="test-vnet-static", + virtual_network_name="test-vnet-static", virtual_networks={"tags": {"additionalProperties": "sample"}}, ).result() print(response) -# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2022-09-01-preview/examples/UpdateVirtualNetwork.json +# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/preview/2023-11-15-preview/examples/UpdateVirtualNetwork.json if __name__ == "__main__": main()